(self, query=None, query_id=None)
| 4913 | """ QueryState is the main class abstraction to manage persistence of Queries """ |
| 4914 | |
| 4915 | def __init__(self, query=None, query_id=None): |
| 4916 | |
| 4917 | if query: |
| 4918 | self.query = query |
| 4919 | self.query_id = query.query_id |
| 4920 | |
| 4921 | if query_id: |
| 4922 | self.query_id = query_id |
| 4923 | self.query = None |
| 4924 | |
| 4925 | self.query_state_base_name = "query_" |
| 4926 | self.query_state_format = ".jsonl" |
| 4927 | |
| 4928 | self.query_path = LLMWareConfig.get_query_path() |
| 4929 | self.output_path = LLMWareConfig.get_query_path() |
| 4930 | |
| 4931 | # check for llmware path & create if not already set up |
| 4932 | if not os.path.exists(LLMWareConfig.get_llmware_path()): |
| 4933 | |
| 4934 | # if not explicitly set up by user, then create folder directory structure |
| 4935 | LLMWareConfig.setup_llmware_workspace() |
| 4936 | |
| 4937 | # if llmware main path exists, but query_path not created or deleted |
| 4938 | if not os.path.exists(self.query_path): |
| 4939 | os.mkdir(self.query_path) |
| 4940 | os.chmod(self.query_path, 0o777) |
| 4941 | |
| 4942 | def get_query_state_fn_from_id(self, prompt_id): |
| 4943 |
nothing calls this directly
no test coverage detected