(self, prompt=None)
| 4519 | """ PromptState is the main class abstraction that handles persisting and lookup of Prompt interactions""" |
| 4520 | |
| 4521 | def __init__(self, prompt=None): |
| 4522 | |
| 4523 | self.prompt = prompt |
| 4524 | self.prompt_state_base_name = "prompt_" |
| 4525 | self.prompt_state_format = ".jsonl" |
| 4526 | |
| 4527 | # check for llmware path & create if not already set up |
| 4528 | if not os.path.exists(LLMWareConfig.get_llmware_path()): |
| 4529 | |
| 4530 | # if not explicitly set up by user, then create folder directory structure |
| 4531 | LLMWareConfig.setup_llmware_workspace() |
| 4532 | |
| 4533 | self.prompt_path = LLMWareConfig.get_prompt_path() |
| 4534 | self.output_path = LLMWareConfig.get_prompt_path() |
| 4535 | |
| 4536 | # edge case - if llmware main path exists, but prompt path not created or deleted |
| 4537 | if not os.path.exists(self.prompt_path): |
| 4538 | os.mkdir(self.prompt_path) |
| 4539 | os.chmod(self.prompt_path, 0o777) |
| 4540 | |
| 4541 | # prompt state written to files |
| 4542 | self.prompt_collection = None |
| 4543 | self.write_to_db = False |
| 4544 | |
| 4545 | def get_prompt_state_fn_from_id(self, prompt_id): |
| 4546 |
nothing calls this directly
no test coverage detected