Creates Prompt for 'Completion' style interface.
(self, query, context, inference_dict=None)
| 5840 | return messages |
| 5841 | |
| 5842 | def prompt_engineer_completion (self, query, context, inference_dict=None): |
| 5843 | |
| 5844 | """ Creates Prompt for 'Completion' style interface. """ |
| 5845 | |
| 5846 | if not self.add_prompt_engineering: |
| 5847 | if context: |
| 5848 | selected_prompt = "default_with_context" |
| 5849 | else: |
| 5850 | selected_prompt = "default_no_context" |
| 5851 | |
| 5852 | else: |
| 5853 | selected_prompt = self.add_prompt_engineering |
| 5854 | |
| 5855 | prompt_dict = PromptCatalog().build_core_prompt(prompt_name=selected_prompt, |
| 5856 | separator=self.separator, |
| 5857 | query=query, context=context, |
| 5858 | inference_dict=inference_dict) |
| 5859 | |
| 5860 | core_prompt = prompt_dict["core_prompt"] |
| 5861 | |
| 5862 | # final wrapping, based on model-specific instruct training format |
| 5863 | # --provides a final 'wrapper' around the core prompt text, based on model expectations |
| 5864 | |
| 5865 | if self.prompt_wrapper: |
| 5866 | core_prompt = PromptCatalog().apply_prompt_wrapper(core_prompt, self.prompt_wrapper, instruction=None) |
| 5867 | |
| 5868 | return core_prompt |
| 5869 | |
| 5870 | def inference(self, prompt, add_context=None, add_prompt_engineering=None, inference_dict=None, |
| 5871 | api_key=None): |
no test coverage detected