Skip to content

Commit

Permalink
Add an ipynb to show basic prompt routing in action (#1493)
Browse files Browse the repository at this point in the history
Add an ipynb to show basic prompt routing in action


Summary:

Test Plan:

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/lastmile-ai/aiconfig/pull/1493).
* __->__ #1493
* #1492
  • Loading branch information
saqadri authored May 21, 2024
2 parents cc3d6b4 + 9a5e3bb commit d6704d2
Show file tree
Hide file tree
Showing 2 changed files with 335 additions and 6 deletions.
29 changes: 23 additions & 6 deletions cookbooks/Basic-Prompt-Routing/assistant.aiconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"execution_count": 0,
"data": "Math",
"metadata": {
"id": "chatcmpl-9RNSj6btMFAysTVV3GegTZWE8ft3Y",
"created": 1716312073,
"id": "chatcmpl-9RNj7MJELOVGtpybTkIjtgGfDx1Us",
"created": 1716313089,
"model": "gpt-4-0613",
"object": "chat.completion.chunk",
"raw_response": {
Expand All @@ -51,7 +51,7 @@
},
{
"name": "math",
"input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ",
"input": "Student Question: {{router.input}}\nTopic: {{router.output}}",
"metadata": {
"model": {
"name": "gpt-4",
Expand All @@ -61,11 +61,28 @@
},
"parameters": {}
},
"outputs": []
"outputs": [
{
"output_type": "execute_result",
"execution_count": 0,
"data": "Hi! I'm your Math Professor.\n\nTo prove that 1+1=2, we can use the Peano's axioms, which are a set of axioms for the natural numbers. \n\nAxiom 1: 1 is a number.\nAxiom 2: Every natural number has a successor, which is also a natural number.\nAxiom 3: There is no natural number whose successor is 1.\nAxiom 4: Distinct natural numbers have distinct successors: i.e., if n \u2260 m, then n+1 \u2260 m+1.\nAxiom 5: If a property belongs to 1, and if it belongs to n+1 whenever it belongs to n, then it belongs to every natural number.\n\nNow, let's define addition in terms of these axioms. \n\nDefinition: Let a and b be natural numbers. Then a+1 is the successor of a, and a+b is the successor of a+(b-1).\n\nUsing this definition, we can prove that 1+1=2.\n\nProof: By definition, 1+1 is the successor of 1+0. But 1+0 is just 1 (since adding 0 to any number doesn't change its value). So 1+1 is the successor of 1. But the successor of 1 is 2 (by Axiom 2). Therefore, 1+1=2.",
"metadata": {
"id": "chatcmpl-9RNjD74ywjmah4aAjUOSkculIVPfm",
"created": 1716313095,
"model": "gpt-4-0613",
"object": "chat.completion.chunk",
"raw_response": {
"content": "Hi! I'm your Math Professor.\n\nTo prove that 1+1=2, we can use the Peano's axioms, which are a set of axioms for the natural numbers. \n\nAxiom 1: 1 is a number.\nAxiom 2: Every natural number has a successor, which is also a natural number.\nAxiom 3: There is no natural number whose successor is 1.\nAxiom 4: Distinct natural numbers have distinct successors: i.e., if n \u2260 m, then n+1 \u2260 m+1.\nAxiom 5: If a property belongs to 1, and if it belongs to n+1 whenever it belongs to n, then it belongs to every natural number.\n\nNow, let's define addition in terms of these axioms. \n\nDefinition: Let a and b be natural numbers. Then a+1 is the successor of a, and a+b is the successor of a+(b-1).\n\nUsing this definition, we can prove that 1+1=2.\n\nProof: By definition, 1+1 is the successor of 1+0. But 1+0 is just 1 (since adding 0 to any number doesn't change its value). So 1+1 is the successor of 1. But the successor of 1 is 2 (by Axiom 2). Therefore, 1+1=2.",
"role": "assistant"
},
"role": "assistant"
}
}
]
},
{
"name": "physics",
"input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ",
"input": "Student Question: {{router.input}}\nTopic: {{router.output}} ",
"metadata": {
"model": {
"name": "gpt-4",
Expand All @@ -79,7 +96,7 @@
},
{
"name": "general",
"input": "\n Student Question: {{router.input}}\n Topic: {{router.output}}\n ",
"input": "Student Question: {{router.input}}\nTopic: {{router.output}}",
"metadata": {
"model": {
"name": "gpt-4",
Expand Down
Loading

0 comments on commit d6704d2

Please sign in to comment.