-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor system resolution and update functions for improved clarity …
…and extendability
- Loading branch information
Showing
19 changed files
with
143 additions
and
197 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,61 @@ | ||
script({ model: "openai:gpt-4o" }) | ||
|
||
/** | ||
* This agent loads the file system prompts. | ||
*/ | ||
defTool( | ||
"agent-fs", | ||
"Invokes gpt-4o to execute a LLM request", | ||
"agent_file_system", | ||
`An agent that uses gpt-4o to execute an LLM requests with tools that can search and read the file system. | ||
`, | ||
{ | ||
prompt: { | ||
type: "string", | ||
description: "the prompt to be executed by the LLM", | ||
}, | ||
}, | ||
async ({ prompt }) => { | ||
const res = await env.generator.runPrompt(_ => { | ||
_.writeText(prompt) | ||
}, { | ||
const res = await env.generator.runPrompt( | ||
(_) => { | ||
_.$`You are an AI assistant that can help with file system tasks. | ||
Answer the user question in the most concise way possible. Use wildcards and regex if needed. | ||
If the question is ambiguous, ask for clarification. | ||
Use tools to search and read the file system. | ||
QUESTION:` | ||
_.writeText(prompt) | ||
}, | ||
{ | ||
model: "openai:gpt-4o", | ||
label: `llm-4o agent_fs ${prompt}`, | ||
tools: "fs", | ||
} | ||
) | ||
return res.text | ||
} | ||
) | ||
|
||
/** | ||
* This agent loads the file system prompts. | ||
*/ | ||
defTool( | ||
"agent_code_interpreter", | ||
"An LLM agent that execute python code in a sandboxed container.", | ||
{ | ||
code: { | ||
type: "string", | ||
description: "the python to be executed by the LLM", | ||
}, | ||
}, | ||
async ({ code }) => { | ||
const res = await env.generator.runPrompt(code, { | ||
model: "openai:gpt-4o", | ||
label: "llm-4o with fs", | ||
tools: "fs" | ||
label: "llm-4o agent_fs", | ||
tools: "python", | ||
}) | ||
return res.text | ||
} | ||
) | ||
|
||
// now as a question about the file system | ||
$`Do a statistical analyzis of all data (*.csv) in the project.` |
Oops, something went wrong.