-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: and start_nanos, end_nanos, timezone to PdlBlock model
Also updates the react UI to display this information. Signed-off-by: Nick Mitchell <[email protected]>
- Loading branch information
Showing
25 changed files
with
1,764 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description: Simple LLM interaction | ||
text: | ||
- "write a hello world example\n" | ||
- model: ollama/granite-code:8b | ||
parameters: | ||
stop_sequences: '!' | ||
temperature: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
SCRIPTDIR=$(cd $(dirname "$0") && pwd) | ||
UI="$SCRIPTDIR"/.. # top of react UI | ||
TOP="$UI"/.. # top of repo | ||
T="$UI"/src/demos # place to store traces | ||
|
||
pdl --trace "$T"/demo1.json "$UI"/demos/demo1.pdl | ||
pdl --trace "$T"/demo2.json "$TOP"/examples/tutorial/model_chaining.pdl | ||
pdl --trace "$T"/demo3.json "$TOP"/examples/fibonacci/fib.pdl | ||
pdl --trace "$T"/demo4.json "$TOP"/examples/chatbot/chatbot.pdl # WARNING: this one requires some human interaction. TODO script this. | ||
pdl --trace "$T"/demo5.json "$TOP"/examples/talk/6-code-json.pdl | ||
pdl --trace "$T"/demo6.json "$UI"/demos/error.pdl || true | ||
pdl --trace "$T"/demo7.json "$TOP"/examples/talk/4-function.pdl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1 @@ | ||
{ | ||
"kind": "text", | ||
"description": "Simple LLM interaction", | ||
"defs": {}, | ||
"text": [ | ||
"write a hello world example\n", | ||
{ | ||
"kind": "model", | ||
"defs": {}, | ||
"platform": "litellm", | ||
"model": "ollama/granite-code:8b", | ||
"parameters": { | ||
"temperature": 0.0, | ||
"stop_sequences": "!" | ||
}, | ||
"result": "```python\nprint(\"hello world\")\n```\n" | ||
} | ||
], | ||
"result": "write a hello world example\n```python\nprint(\"hello world\")\n```\n" | ||
} | ||
{"kind": "text", "start_nanos": 1737481387443288000, "end_nanos": 1737481388576573000, "timezone": "EST", "description": "Simple LLM interaction", "defs": {}, "text": ["write a hello world example\n", {"kind": "model", "start_nanos": 1737481387444188000, "end_nanos": 1737481388576550000, "timezone": "EST", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "parameters": {"temperature": 0.0, "stop_sequences": "!"}, "result": "```python\nprint(\"hello world\")\n```\n"}], "result": "write a hello world example\n```python\nprint(\"hello world\")\n```\n"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"kind": "text", "description": "Model chaining", "defs": {}, "text": ["Hello\n", {"kind": "model", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "parameters": {"stop_sequences": "!"}, "result": "Hello! How can I help you today?\n"}, "\nDid you just say Hello?\n", {"kind": "model", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "parameters": {"stop_sequences": "!"}, "result": "Yes, I did. Is there anything I can help you with?\n"}], "result": "Hello\nHello! How can I help you today?\n\nDid you just say Hello?\nYes, I did. Is there anything I can help you with?\n"} | ||
{"kind": "text", "start_nanos": 1737481389613977000, "end_nanos": 1737481390433251000, "timezone": "EST", "description": "Model chaining", "defs": {}, "text": ["Hello\n", {"kind": "model", "start_nanos": 1737481389614907000, "end_nanos": 1737481390031193000, "timezone": "EST", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "parameters": {"stop_sequences": "!"}, "result": "Hello! How can I help you today?\n"}, "\nDid you just say Hello?\n", {"kind": "model", "start_nanos": 1737481390031579000, "end_nanos": 1737481390433219000, "timezone": "EST", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "parameters": {"stop_sequences": "!"}, "result": "Yes, I did. How can I assist you further?\n"}], "result": "Hello\nHello! How can I help you today?\n\nDid you just say Hello?\nYes, I did. How can I assist you further?\n"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1 @@ | ||
{ | ||
"kind": "text", | ||
"description": "Fibonacci", | ||
"defs": {}, | ||
"text": [ | ||
{ | ||
"kind": "model", | ||
"defs": {}, | ||
"platform": "litellm", | ||
"model": "ollama/granite-code:8b", | ||
"input": "Write a Python function to compute the Fibonacci sequence. Do not include a doc string.\n\n", | ||
"parameters": { | ||
"temperature": 0.0 | ||
}, | ||
"def": "CODE", | ||
"result": "Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n" | ||
}, | ||
"\nExtract the Python code from the LLM response\n", | ||
{ | ||
"kind": "code", | ||
"defs": {}, | ||
"lang": "python", | ||
"code": "s = \"\"\"'Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n '\"\"\"\nresult = s.split(\"```\")[1].replace(\"python\", \"\")\n", | ||
"def": "EXTRACTED", | ||
"result": "\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n" | ||
}, | ||
"\nFind a random number between 1 and 20\n", | ||
{ | ||
"kind": "code", | ||
"defs": {}, | ||
"lang": "python", | ||
"code": "import random\nresult = random.randint(1, 20)\n", | ||
"def": "N", | ||
"result": 14 | ||
}, | ||
"\nNow compute `fibonacci(14)`\n", | ||
{ | ||
"kind": "code", | ||
"defs": {}, | ||
"lang": "python", | ||
"code": "\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n\nresult = fibonacci(14)\n", | ||
"def": "RESULT", | ||
"contribute": [], | ||
"result": 377 | ||
}, | ||
"The result is: 377", | ||
"\n\nExplain what the above code does and what the result means\n\n", | ||
{ | ||
"kind": "model", | ||
"defs": {}, | ||
"platform": "litellm", | ||
"model": "ollama/granite-code:8b", | ||
"result": "The Python code defines a recursive function called `fibonacci` that calculates the nth Fibonacci number. The function checks if n is less than or equal to 1, in which case it returns n. Otherwise, it recursively calls itself with arguments n-1 and n-2, and adds the results together.\n\nThe result of `fibonacci(14)` is 377, which means that the 14th Fibonacci number is 377. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, starting from 0 and 1. So, the first few Fibonacci numbers are:\n\n0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...\n\nThe 14th Fibonacci number is 377, which means that the sum of the 13th and 12th Fibonacci numbers is 377. This is an example of how the Fibonacci sequence can be used to calculate the sum of two preceding terms in the sequence.\n" | ||
} | ||
], | ||
"result": "Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n\nExtract the Python code from the LLM response\n\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n\nFind a random number between 1 and 20\n14\nNow compute `fibonacci(14)`\nThe result is: 377\n\nExplain what the above code does and what the result means\n\nThe Python code defines a recursive function called `fibonacci` that calculates the nth Fibonacci number. The function checks if n is less than or equal to 1, in which case it returns n. Otherwise, it recursively calls itself with arguments n-1 and n-2, and adds the results together.\n\nThe result of `fibonacci(14)` is 377, which means that the 14th Fibonacci number is 377. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, starting from 0 and 1. So, the first few Fibonacci numbers are:\n\n0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...\n\nThe 14th Fibonacci number is 377, which means that the sum of the 13th and 12th Fibonacci numbers is 377. This is an example of how the Fibonacci sequence can be used to calculate the sum of two preceding terms in the sequence.\n" | ||
} | ||
{"kind": "text", "start_nanos": 1737481391456942000, "end_nanos": 1737481396443243000, "timezone": "EST", "description": "Fibonacci", "defs": {}, "text": [{"kind": "model", "start_nanos": 1737481391456982000, "end_nanos": 1737481392659272000, "timezone": "EST", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "input": "Write a Python function to compute the Fibonacci sequence. Do not include a doc string.\n\n", "parameters": {"temperature": 0.0}, "def": "CODE", "result": "Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n"}, "\nExtract the Python code from the LLM response\n", {"kind": "code", "start_nanos": 1737481392659645000, "end_nanos": 1737481392661060000, "timezone": "EST", "defs": {}, "lang": "python", "code": "s = \"\"\"'Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n '\"\"\"\nresult = s.split(\"```\")[1].replace(\"python\", \"\")\n", "def": "EXTRACTED", "result": "\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n"}, "\nFind a random number between 1 and 20\n", {"kind": "code", "start_nanos": 1737481392661332000, "end_nanos": 1737481392661708000, "timezone": "EST", "defs": {}, "lang": "python", "code": "import random\n# (In PDL, set `result` to the output you wish for your code block.)\nresult = random.randint(1, 20)\n", "def": "N", "result": 11}, "\nNow compute `fibonacci(11)`\n", {"kind": "code", "start_nanos": 1737481392662005000, "end_nanos": 1737481392662424000, "timezone": "EST", "defs": {}, "lang": "python", "code": "\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n\nresult = fibonacci(11)\n", "def": "RESULT", "contribute": [], "result": 89}, "The result is: 89", "\n\nExplain what the above code does and what the result means\n\n", {"kind": "model", "start_nanos": 1737481392662831000, "end_nanos": 1737481396443207000, "timezone": "EST", "defs": {}, "platform": "litellm", "model": "ollama/granite-code:8b", "result": "The code defines a recursive function called `fibonacci` that takes an integer `n` as input. If `n` is less than or equal to 1, the function simply returns `n`. Otherwise, it recursively calls itself with `n-1` and `n-2`, adds the results, and returns the sum.\n\nThe result of computing `fibonacci(11)` is 89. This means that the 11th number in the Fibonacci sequence is 89. The Fibonacci sequence starts with 0 and 1, so the first few numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and 55. The 11th number in this sequence is 89.\n"}], "result": "Here is the implementation of the Fibonacci sequence in Python:\n\n```python\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n```\n\nExtract the Python code from the LLM response\n\ndef fibonacci(n):\n if n <= 1:\n return n\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n\nFind a random number between 1 and 20\n11\nNow compute `fibonacci(11)`\nThe result is: 89\n\nExplain what the above code does and what the result means\n\nThe code defines a recursive function called `fibonacci` that takes an integer `n` as input. If `n` is less than or equal to 1, the function simply returns `n`. Otherwise, it recursively calls itself with `n-1` and `n-2`, adds the results, and returns the sum.\n\nThe result of computing `fibonacci(11)` is 89. This means that the 11th number in the Fibonacci sequence is 89. The Fibonacci sequence starts with 0 and 1, so the first few numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and 55. The 11th number in this sequence is 89.\n"} |
Oops, something went wrong.