[{ "content": [ { "type": "text", "text": "You are an helpful AI assistant. My name is {{name}}" } ], "role": "system" },{{history_messages}},{ "content": [ { "type": "text", "text": "{{input}}" } ], "role": "user" }]
variables= {"name" : "portkey"}
variables= {"name" : "portkey", "history_messages" : []}
ValidatorIterator(index=0, schema=None),
[{ "content": [ { "type": "text", "text": "You're a helpful assistant." } ], "role": "system" },{{history_messages}},{ "content": [ { "type": "text", "text": "Tell me a joke about the topic {{topic}}" } ], "role": "user" }]
from portkey_ai import Portkey from app.core.config import settings prompt_id = "pp-sample-dcb456" portkey_api_key = settings.PORTKEY_API_KEY portkey_client = Portkey(api_key=portkey_api_key) history_messages =[ {"role": "user", "content": [{"type": "text","text": "Always start the joke with 'This is a Joke about'"}]}, {"role": "assistant", "content": [{"type": "text","text": "Sure, I will do that"}]}, ] # history_messages =[ # {"role": "user", "content": "Always start the joke with 'This is a Joke about'"}, # {"role": "assistant", "content": "Sure, I will do that"}, # ] portkey_client.prompts.render( prompt_id=prompt_id, variables={"history_messages": history_messages, "topic" : "dogs"} )
PromptRender(success=True, data=PromptRenderData(messages=[ChatCompletionMessage(content=ValidatorIterator(index=0, schema=None), role='system', function_call=None, tool_calls=None), ChatCompletionMessage(content=ValidatorIterator(index=0, schema=None), role='user', function_call=None, tool_calls=None), ChatCompletionMessage(content=ValidatorIterator(index=0, schema=None), role='assistant', function_call=None, tool_calls=None), ChatCompletionMessage(content=ValidatorIterator(index=0, schema=None), role='user', function_call=None, tool_calls=None)], prompt=None, model='gpt-4o-mini', suffix=None, max_tokens=500, temperature=1.0, top_k=None, top_p=1.0, n=1, stop_sequences=None, timeout=None, functions=None, function_call=None, logprobs=None, top_logprobs=None, echo=None, stop=None, presence_penalty=0, frequency_penalty=0, best_of=None, logit_bias=None, user=None, organization=None, tool_choice=None, tools=None))
[{ "content": [ { "type": "text", "text": "You are an helpful AI assistant. My name is {{name}}" } ], "role": "system" },{{#history_messages}}{{history_messages}},{{/history_messages}}{ "content": [ { "type": "text", "text": "{{input}}" } ], "role": "user" }]
<head><title>413 Request Entity Too Large</title></head> <body> <center><h1>413 Request Entity Too Large</h1></center> <hr><center>nginx</center> </body> </html>