Skip to content

Commit

Permalink
Adds update_prompt_template function
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonWeill committed Aug 2, 2023
1 parent f6ef7b2 commit dd6935f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/jupyter-ai-magics/jupyter_ai_magics/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ async def _call_in_executor(self, *args, **kwargs) -> Coroutine[Any, Any, str]:
_call_with_args = functools.partial(self._call, *args, **kwargs)
return await loop.run_in_executor(executor, _call_with_args)

def update_prompt_template(format: str, template: str):
"""
Changes the class-level prompt template for a given format.
"""
prompt_templates[format] = PromptTemplate.from_template(template)

def prompt_template(self, format) -> PromptTemplate:
"""
Produce a prompt template suitable for use with a particular model, to
Expand Down

0 comments on commit dd6935f

Please sign in to comment.