diff --git a/apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx b/apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx index 712091d54d..84cdccb3b5 100644 --- a/apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx +++ b/apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx @@ -113,6 +113,7 @@ const PromptTab = ({ prompt }: PromptTabInterface) => { void; + promptName: string; }; -const CREATING_PROMPT = `import opik +const getCreatingPrompt = (promptName: string) => `import opik # Create a new Prompt instance prompt = opik.Prompt( - name="greeting_prompt", + name="${promptName}", prompt="Hello, {name}! Welcome to {location}. How can I assist you today?" ) @@ -26,12 +27,12 @@ formatted_prompt = prompt.format(name="Alice", location="Wonderland") print(formatted_prompt) `; -const GETTING_PROMPT = `import opik +const getGettingPrompt = (promptName: string) => `import opik client = opik.Opik() # Get the most recent version of a prompt -prompt = client.get_prompt(name="greeting_prompt") +prompt = client.get_prompt(name="${promptName}") # Format the prompt with the given parameters formatted_prompt = prompt.format(name="Alice", location="Wonderland") @@ -40,7 +41,7 @@ print(formatted_prompt) const UseThisPromptDialog: React.FunctionComponent< UseThisPromptDialogProps -> = ({ open, setOpen }) => { +> = ({ open, setOpen, promptName }) => { return (
Creating a prompt
- +
Getting a prompt
- +