My latest approach:
def get_prompt_template() -> str:
portkey_client = Portkey(
api_key=app_config.PORTKEY_API_KEY,
)
render_response = portkey_client.prompts.render(
prompt_id=app_config.GATEWAY_PROMPT_ID,
variables={"context": "context data below"},
stream=False,
)
return render_response.data
It prints this error when I try to use the function. I pass in variables but in reality my prompt doesn't have any variables since I'm just fetching the prompt to pass it on to SYSTEM_PROMPT for use downstream.
I tried without passing variables and variables are required. If I give dummy variables, it gives this error. If I add the variable "context" to my prompt, it still gives this error:
line 176, in __init__
self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for PromptRender
data.messages.0.content
Input should be a valid string [type=string_type, input_value=[{'type': 'text', 'text':...context data below\n "}], input_type=list]
For further information visit https://errors.pydantic.dev/2.7/v/string_type
data.messages.1.content
Input should be a valid string [type=string_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.7/v/string_type