MCPcopy
hub / github.com/llmware-ai/llmware / prompt_engineer_completion

Method prompt_engineer_completion

llmware/models.py:5842–5868  ·  view source on GitHub ↗

Creates Prompt for 'Completion' style interface.

(self, query, context, inference_dict=None)

Source from the content-addressed store, hash-verified

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):

Callers 1

inferenceMethod · 0.95

Calls 3

PromptCatalogClass · 0.85
build_core_promptMethod · 0.80
apply_prompt_wrapperMethod · 0.80

Tested by

no test coverage detected