Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor agent_fs to defAgent and update related documentation #755

Merged
merged 7 commits into from
Oct 4, 2024
27 changes: 25 additions & 2 deletions docs/genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/src/components/BuiltinTools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import { LinkCard } from '@astrojs/starlight/components';

### Builtin tools

Check failure on line 8 in docs/src/components/BuiltinTools.mdx

View workflow job for this annotation

GitHub Actions / build

The link to the agent_fs documentation has been removed, which may lead to a broken link or missing information for users.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link to the agent_fs documentation has been removed, which may lead to a broken link or missing information for users.

generated by pr-docs-review-commit broken_link

<LinkCard title="agent_fs" description="Agent that can query files to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_fs" />
<LinkCard title="agent_git" description="Agent that can query a repository using Git to accomplish tasks. Provide all the context information available to execute git queries." href="/genaiscript/reference/scripts/system#systemagent_git" />
<LinkCard title="agent_github" description="Agent that can query GitHub to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_github" />
<LinkCard title="agent_interpreter" description="Run code interpreters for Python, Math. Use this agent to ground computation questions." href="/genaiscript/reference/scripts/system#systemagent_interpreter" />
Expand Down
54 changes: 13 additions & 41 deletions docs/src/content/docs/reference/scripts/system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,60 +101,32 @@
Agent that can find, search or read files to accomplish tasks



Check failure on line 104 in docs/src/content/docs/reference/scripts/system.mdx

View workflow job for this annotation

GitHub Actions / build

The description for the `agent_fs` tool has been removed, which may leave users without necessary context or information about the tool's purpose.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description for the agent_fs tool has been removed, which may leave users without necessary context or information about the tool's purpose.

generated by pr-docs-review-commit missing_content

- tool `agent_fs`: Agent that can query files to accomplish tasks


`````js wrap title="system.agent_fs"
system({
title: "Agent that can find, search or read files to accomplish tasks",
})

const model = env.vars.agentFsModel

defTool(
"agent_fs",
"Agent that can query files to accomplish tasks",
defAgent(
"fs",
"Queries files to accomplish tasks",
"Your are a helpfull LLM agent that can query the file system to accomplish tasks.",
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a typo here.

generated by pr-docs-review-commit typo

{
query: {
type: "string",
description: "Query to answer",
},
},
async (args) => {
const { context, query } = args
context.log(`agent fs: ${query}`)
const res = await runPrompt(
(_) => {
_.def("QUERY", query)

_.$`Your are a helpfull LLM agent that can query the file system to accomplish tasks.

Analyze and answer QUERY.

- Assume that your answer will be analyzed by an LLM, not a human.
- If you are missing information, reply "MISSING_INFO: <what is missing>".
- If you cannot answer the query, return "NO_ANSWER: <reason>".
`
},
{
model,
system: [
"system",
"system.tools",
"system.explanations",
"system.fs_find_files",
"system.fs_read_file",
"system.fs_diff_files",
"system.retrieval_fuzz_search",
"system.md_frontmatter",
],
label: "agent file system",
}
)
return res
model,
tools: [
"fs_find_files",
"fs_read_file",
"fs_diff_files",
"retrieval_fuzz_search",
"md_frontmatter",
],
}
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'agent_fs' tool has been refactored to 'defAgent' with a simplified interface. Verify that the documentation reflects the correct usage and that examples are updated to match the new interface.

generated by pr-docs-review-commit documentation_update

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The agent_fs tool has been refactored to defAgent. Ensure that the documentation reflects the new usage and that examples or references to the old agent_fs are updated accordingly.

generated by pr-docs-review-commit documentation_content


Check failure on line 129 in docs/src/content/docs/reference/scripts/system.mdx

View workflow job for this annotation

GitHub Actions / build

The detailed documentation and example usage for the `agent_fs` tool have been replaced with a less informative `defAgent` call, reducing the amount of information available to the user.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The detailed documentation and example usage for the agent_fs tool have been replaced with a less informative defAgent call, reducing the amount of information available to the user.

generated by pr-docs-review-commit missing_content

`````


Expand Down
27 changes: 25 additions & 2 deletions genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions packages/auto/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions packages/core/src/genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 12 additions & 40 deletions packages/core/src/genaisrc/system.agent_fs.genai.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,18 @@ system({

const model = env.vars.agentFsModel

defTool(
"agent_fs",
"Agent that can query files to accomplish tasks",
defAgent(
"fs",
"Queries files to accomplish tasks",
"Your are a helpfull LLM agent that can query the file system to accomplish tasks.",
{
query: {
type: "string",
description: "Query to answer",
},
},
async (args) => {
const { context, query } = args
context.log(`agent fs: ${query}`)
const res = await runPrompt(
(_) => {
_.def("QUERY", query)

_.$`Your are a helpfull LLM agent that can query the file system to accomplish tasks.

Analyze and answer QUERY.

- Assume that your answer will be analyzed by an LLM, not a human.
- If you are missing information, reply "MISSING_INFO: <what is missing>".
- If you cannot answer the query, return "NO_ANSWER: <reason>".
`
},
{
model,
system: [
"system",
"system.tools",
"system.explanations",
"system.fs_find_files",
"system.fs_read_file",
"system.fs_diff_files",
"system.retrieval_fuzz_search",
"system.md_frontmatter",
],
label: "agent file system",
}
)
return res
model,
tools: [
"fs_find_files",
"fs_read_file",
"fs_diff_files",
"retrieval_fuzz_search",
"md_frontmatter",
],
}
)
Loading
Loading