Welcome to Portkey Forum

Updated 8 months ago

Documentation Bug: Async Function getPromptTemplate()

Documentation bug:

Plain Text
async function getPromptTemplate() {
    const render_response = await portkey.prompts.render({
        promptID: "PROMPT_ID",
        variables: { "movie":"Dune 2" }
    })
    return render_response.data.data;
}


render_response has no nested object .data.data. It has .data.

Also, have you considered typescript def for the response?
H
C
V
3 comments
Here is a start on a typedef

Plain Text
type PortKeyRenderResponse = {
  success: boolean;
  data: {
    model: string;
    n: number;
    top_p: number;
    max_tokens: number;
    temperature: number;
    response_format: any;
    presence_penality: number;
    frequency_penalty: number;
    prompt_id: string;
    messages: {
      role: string;
      content: string;
    }[];
  };
};
Hey!

Thanks for sharing this. We will be adding this specific type definition of the prompt render. 🌟
Thanks for pointing this out as well, @Hans Magnus. Have fixed it on the docs!
Add a reply
Sign up and join the conversation on Discord