From 2aacea6f41ba1242d3639ce1fa78cd57d0b3f7a1 Mon Sep 17 00:00:00 2001 From: Sarmad Qadri Date: Tue, 21 May 2024 13:35:32 -0400 Subject: [PATCH] Convert routing cookbook to an actual aiconfig.json Summary: Test Plan: --- .../assistant.aiconfig.json | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 cookbooks/Basic-Prompt-Routing/assistant.aiconfig.json diff --git a/cookbooks/Basic-Prompt-Routing/assistant.aiconfig.json b/cookbooks/Basic-Prompt-Routing/assistant.aiconfig.json new file mode 100644 index 000000000..55e5a30d2 --- /dev/null +++ b/cookbooks/Basic-Prompt-Routing/assistant.aiconfig.json @@ -0,0 +1,96 @@ +{ + "name": "assistant_config", + "schema_version": "latest", + "metadata": { + "parameters": { + "student_question": "Prove that 1+1=2?", + "philosophy_question": "What is the meaning of life?", + "physics_question": "What is entropy?" + }, + "models": { + "gpt-4": { + "top_k": 40, + "top_p": 1, + "model": "gpt-4", + "temperature": 0.0 + } + } + }, + "description": "teaching assistant config", + "prompts": [ + { + "name": "router", + "input": "{{student_question}}", + "metadata": { + "model": { + "name": "gpt-4", + "settings": { + "system_prompt": "\n You will be given a question. Classify the question as one of the following topics: \n 1. Math\n 2. Physics\n 3. General\n Output the topic name.\n " + } + }, + "parameters": {} + }, + "outputs": [ + { + "output_type": "execute_result", + "execution_count": 0, + "data": "Math", + "metadata": { + "id": "chatcmpl-9RNSj6btMFAysTVV3GegTZWE8ft3Y", + "created": 1716312073, + "model": "gpt-4-0613", + "object": "chat.completion.chunk", + "raw_response": { + "content": "Math", + "role": "assistant" + }, + "role": "assistant" + } + } + ] + }, + { + "name": "math", + "input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ", + "metadata": { + "model": { + "name": "gpt-4", + "settings": { + "system_prompt": "\n You are a very good mathematician. You are great at answering math questions. \n You are so good because you are able to break down hard problems into their component parts, \n answer the component parts, and then put them together to answer the broader question.\n \n Output: If topic is Math, introduce yourself as 'Hi! I'm your Math Professor' and then answer the question. \n If the topic is not Math, output 'Sorry I only answer Math questions'.\n " + } + }, + "parameters": {} + }, + "outputs": [] + }, + { + "name": "physics", + "input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ", + "metadata": { + "model": { + "name": "gpt-4", + "settings": { + "system_prompt": "\n You are a very smart physics professor. You are great at answering questions about physics in a concise and easy\n to understand manner. When you don't know the answer to a question you admit that you don't know.\n \n Output: If topic is Physics, introduce yourself as 'Hi! I'm your Physics Professor' and then answer the question. \n If the topic is not Physics, output 'Sorry I only answer Physics questions'.\n " + } + }, + "parameters": {} + }, + "outputs": [] + }, + { + "name": "general", + "input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ", + "metadata": { + "model": { + "name": "gpt-4", + "settings": { + "system_prompt": "\n You are a helpful assistant. Answer the question as accurately as you can. \n \n Introduce yourself as \"Hi I'm your general assistant\". Then answer the question. \n " + } + }, + "parameters": {} + }, + "outputs": [] + } + ], + "$schema": "https://json.schemastore.org/aiconfig-1.0" +}