mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
example X42PromptManagement
This commit is contained in:
parent
803e643f64
commit
c3e33495b5
1 changed files with 36 additions and 0 deletions
36
litellm/proxy/custom_prompt_management.py
Normal file
36
litellm/proxy/custom_prompt_management.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
|
from litellm._logging import verbose_logger
|
||||||
|
from litellm.integrations.custom_prompt_management import CustomPromptManagement
|
||||||
|
from litellm.types.llms.openai import AllMessageValues
|
||||||
|
from litellm.types.utils import StandardCallbackDynamicParams
|
||||||
|
|
||||||
|
|
||||||
|
class X42PromptManagement(CustomPromptManagement):
|
||||||
|
def get_chat_completion_prompt(
|
||||||
|
self,
|
||||||
|
model: str,
|
||||||
|
messages: List[AllMessageValues],
|
||||||
|
non_default_params: dict,
|
||||||
|
prompt_id: str,
|
||||||
|
prompt_variables: Optional[dict],
|
||||||
|
dynamic_callback_params: StandardCallbackDynamicParams,
|
||||||
|
) -> Tuple[str, List[AllMessageValues], dict]:
|
||||||
|
"""
|
||||||
|
Returns:
|
||||||
|
- model: str - the model to use (can be pulled from prompt management tool)
|
||||||
|
- messages: List[AllMessageValues] - the messages to use (can be pulled from prompt management tool)
|
||||||
|
- non_default_params: dict - update with any optional params (e.g. temperature, max_tokens, etc.) to use (can be pulled from prompt management tool)
|
||||||
|
"""
|
||||||
|
verbose_logger.debug(
|
||||||
|
f"in async get chat completion prompt. Prompt ID: {prompt_id}, Prompt Variables: {prompt_variables}, Dynamic Callback Params: {dynamic_callback_params}"
|
||||||
|
)
|
||||||
|
|
||||||
|
return model, messages, non_default_params
|
||||||
|
|
||||||
|
@property
|
||||||
|
def integration_name(self) -> str:
|
||||||
|
return "x42-prompt-management"
|
||||||
|
|
||||||
|
|
||||||
|
x42_prompt_management = X42PromptManagement()
|
Loading…
Add table
Add a link
Reference in a new issue