-
Notifications
You must be signed in to change notification settings - Fork 127
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
Conversation
@@ -6,7 +6,6 @@ import { LinkCard } from '@astrojs/starlight/components'; | |||
|
|||
### Builtin tools | |||
|
There was a problem hiding this comment.
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
@@ -102,7 +102,7 @@ Agent that can find, search or read files to accomplish tasks | |||
|
|||
|
|||
|
There was a problem hiding this comment.
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
"fs_diff_files", | ||
"retrieval_fuzz_search", | ||
"md_frontmatter", | ||
], | ||
} | ||
) | ||
|
There was a problem hiding this comment.
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
The modifications in this pull request introduce a new concept, an "agent". It appears that these agents are a type of tool in the system that can be defined in a similar way to other tools, but they have some unique characteristics. Changes include:
Concerns
Overall, the code changes seem to be well-structured and consistent. Here is a possible enhancement: @@ -280,6 +280,10 @@ export function createChatGenerationContext(
)
}
}
+ // Defines a new type of tool called "agent"
+ // An agent is a tool that uses LLM to perform certain tasks
+ // This function is used to define an agent with specified name, description, function, and options
+ // The options can include system, tools, and other parameters
const defAgent = (
name: string,
description: string, LGTM 🚀
|
<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" /> | ||
<LinkCard title="agent_user_input" description="Ask user for input to confirm, select or answer a question." href="/genaiscript/reference/scripts/system#systemagent_user_input" /> | ||
<LinkCard title="fs_diff_files" description="Computes a diff between two files." href="/genaiscript/reference/scripts/system#systemfs_diff_files" /> | ||
<LinkCard title="fs_find_files" description="Finds file matching a glob pattern. Use pattern to specify a regular expression to search for in the file content." href="/genaiscript/reference/scripts/system#systemfs_find_files" /> | ||
<LinkCard title="fs_read_file" description="Reads a file as text from the file system. Returns undefined if the file does not exist." href="/genaiscript/reference/scripts/system#systemfs_read_file" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'agent_fs', 'agent_git', 'agent_github', 'agent_interpreter', and 'agent_user_input' LinkCards have been removed. Ensure that this change is intentional and that any references to these agents are updated accordingly in the documentation.
generated by pr-docs-review-commit
documentation_update
"fs_diff_files", | ||
"retrieval_fuzz_search", | ||
"md_frontmatter", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
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
return res | ||
} | ||
`Your are a helpfull LLM agent that can use git tools to query a repository. `, | ||
{ model, tools: ["git"] } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'agent_git' 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
"system.github_files", | ||
"system.github_issues", | ||
"system.github_pulls", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'agent_github' 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
"system.explanations", | ||
"system.math", | ||
"system.python_code_interpreter", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'agent_interpreter' 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
) | ||
return res | ||
model, | ||
system: ["system", "system.tools", "system.user_input"], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'agent_user_input' 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
…ools type definition.
…ine chat context logic
<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" /> | ||
<LinkCard title="agent_user_input" description="Ask user for input to confirm, select or answer a question." href="/genaiscript/reference/scripts/system#systemagent_user_input" /> | ||
<LinkCard title="fs_diff_files" description="Computes a diff between two files." href="/genaiscript/reference/scripts/system#systemfs_diff_files" /> | ||
<LinkCard title="fs_find_files" description="Finds file matching a glob pattern. Use pattern to specify a regular expression to search for in the file content." href="/genaiscript/reference/scripts/system#systemfs_find_files" /> | ||
<LinkCard title="fs_read_file" description="Reads a file as text from the file system. Returns undefined if the file does not exist." href="/genaiscript/reference/scripts/system#systemfs_read_file" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of several LinkCard components may indicate that the corresponding agents are deprecated or moved. Ensure that this change is intentional and that any references to these agents are updated or removed elsewhere in the documentation to maintain consistency.
generated by pr-docs-review-commit
documentation_content
"fs_diff_files", | ||
"retrieval_fuzz_search", | ||
"md_frontmatter", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
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
id: kind === "Agent" ? "agent_" + id : id, | ||
description, | ||
kind: kind.toLocaleLowerCase(), | ||
}) | ||
return "" | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regular expression used in parsePromptScriptTools
function does not account for case sensitivity in the kind
group. This could lead to incorrect tool identification if the kind
is not in the exact case as expected. Consider using case-insensitive matching.
generated by pr-review-commit
regex_handling
return res | ||
} | ||
`Your are a helpfull LLM agent that can use git tools to query a repository. `, | ||
{ model, system: ["system.github_info"], tools: ["git"] } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent_git
tool has been refactored to defAgent
. Ensure that the documentation reflects the new usage and that examples or references to the old agent_git
are updated accordingly.
generated by pr-docs-review-commit
documentation_content
} | ||
|
||
type ChatAgentHandler = (ctx: ChatGenerationContext, args: ChatFunctionArgs) => Awaitable<unknown> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DefAgentOptions
interface is defined but not used anywhere in the code. This could lead to confusion for other developers. Consider removing it if it's not needed, or use it where it's supposed to be used.
generated by pr-review-commit
unused_type
"system.github_files", | ||
"system.github_issues", | ||
"system.github_pulls", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent_github
tool has been refactored to defAgent
. Ensure that the documentation reflects the new usage and that examples or references to the old agent_github
are updated accordingly.
generated by pr-docs-review-commit
documentation_content
"system.explanations", | ||
"system.math", | ||
"system.python_code_interpreter", | ||
], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent_interpreter
tool has been refactored to defAgent
. Ensure that the documentation reflects the new usage and that examples or references to the old agent_interpreter
are updated accordingly.
generated by pr-docs-review-commit
documentation_content
) | ||
return res | ||
model, | ||
system: ["system", "system.tools", "system.user_input"], | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent_user_input
tool has been refactored to defAgent
. Ensure that the documentation reflects the new usage and that examples or references to the old agent_user_input
are updated accordingly.
generated by pr-docs-review-commit
documentation_content
` | ||
const { auth, owner, repo, baseUrl } = info | ||
$`- current github repository: ${owner}/${repo}` | ||
if (baseUrl) $`- current github base url: ${baseUrl}` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitHub information section has been simplified. Verify that the new format provides all necessary information and is consistent with the rest of the documentation.
generated by pr-docs-review-commit
documentation_content
…project handling.
defTool( | ||
"agent_github", | ||
defAgent( | ||
"github", | ||
"Agent that can query GitHub to accomplish tasks", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for the github
agent has been simplified and made more concise.
generated by pr-docs-review-commit
documentation_update
defTool( | ||
"agent_interpreter", | ||
defAgent( | ||
"interpreter", | ||
"Run code interpreters for Python, Math. Use this agent to ground computation questions.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for the interpreter
agent has been simplified and made more concise.
generated by pr-docs-review-commit
documentation_update
defTool( | ||
"agent_user_input", | ||
defAgent( | ||
"user_input", | ||
"Ask user for input to confirm, select or answer a question.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for the user_input
agent has been simplified and made more concise.
generated by pr-docs-review-commit
documentation_update
@@ -888,7 +752,7 @@ defTool("git_branch_list", "List all branches using git.", {}, async () => { | |||
|
|||
defTool( | |||
"git_diff", | |||
"Computes file diffs using git. If the diff is too large, it returns the list of modified/added files.", | |||
"Computes file diffs using the git diff command. If the diff is too large, it returns the list of modified/added files.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for git_diff
has been updated to clarify the use of the git diff command.
generated by pr-docs-review-commit
documentation_update
"git_log", | ||
"Generates a log of commits using git.", | ||
"git_list_commits", | ||
"Generates a history of commits using the git log command.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git_log
tool has been renamed to git_list_commits
and the description updated to reflect the use of the git log command.
generated by pr-docs-review-commit
documentation_update
` | ||
const { auth, owner, repo, baseUrl } = info | ||
$`- current github repository: ${owner}/${repo}` | ||
if (baseUrl) $`- current github base url: ${baseUrl}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitHub information output format has been changed to a more concise bullet list format.
generated by pr-docs-review-commit
documentation_update
<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" /> | ||
<LinkCard title="agent_user_input" description="Ask user for input to confirm, select or answer a question." href="/genaiscript/reference/scripts/system#systemagent_user_input" /> | ||
<LinkCard title="fs_diff_files" description="Computes a diff between two files." href="/genaiscript/reference/scripts/system#systemfs_diff_files" /> |
There was a problem hiding this comment.
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
Register JavaScript functions as [LLM tools](/genaiscript/reference/scripts/tools/) | ||
|
||
```js wrap | ||
defTool("weather", "live weahter", |
There was a problem hiding this comment.
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
defAgent( | ||
"fs", | ||
"Queries files to accomplish tasks", | ||
"Your are a helpfull LLM agent that can query the file system to accomplish tasks.", |
There was a problem hiding this comment.
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
) | ||
return res | ||
} | ||
`Your are a helpfull LLM agent that can use the git tools to query the current repository. The current repository is the same as github repository.`, |
There was a problem hiding this comment.
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
"Agent that can query GitHub to accomplish tasks", | ||
`Your are a helpfull LLM agent that can query GitHub to accomplish tasks. | ||
Prefer diffing job logs rather downloading entire logs which can be very large.`, |
There was a problem hiding this comment.
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
"Run code interpreters for Python, Math. Use this agent to ground computation questions.", | ||
`You are an agent that can run code interpreters for Python, Math. | ||
- Prefer math_eval for math expressions as it is much more efficient. | ||
- To use file data in python, prefer copying data files using python_code_interpreter_copy_files rather than inline data in code. |
There was a problem hiding this comment.
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
"Ask user for input to confirm, select or answer a question.", | ||
`You are an agent that can ask questions to the user and receive answers. Use the tools to interact with the user. | ||
- the message should be very clear. Add context from the conversation as needed.`, |
There was a problem hiding this comment.
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
@@ -1027,9 +892,9 @@ defTool( | |||
defTool( | |||
"github_actions_runs_list", | |||
`List all runs for a workflow or the entire repository. |
There was a problem hiding this comment.
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
Investigator reportSummary of the Root CauseThe failure in the GitHub Action is due to TypeScript errors in the Code Responsible for the FailureThe error messages in the logs are: src/testhost.ts:52:14 - error TS2420: Class 'TestHost' incorrectly implements interface 'RuntimeHost'.
Property 'project' is missing in type 'TestHost' but required in type 'RuntimeHost'.
52 export class TestHost implements RuntimeHost {
~~~~~~~~ And src/testhost.ts:78:24 - error TS2345: Argument of type 'TestHost' is not assignable to parameter of type 'RuntimeHost'.
Property 'project' is missing in type 'TestHost' but required in type 'RuntimeHost'.
78 setRuntimeHost(new TestHost())
~~~~~~~~~~~~~~ Suggested FixTo fix these errors, the Suggested Code Diff--- a/src/testhost.ts
+++ b/src/testhost.ts
@@ -51,6 +51,8 @@
export class TestHost implements RuntimeHost {
+ project: Project;
+
constructor() {
// Initialize other properties
+ this.project = /* initialization */;
}
} This change includes the missing
|
It seems I encountered some issues accessing the specific data needed. Here's how you can proceed to investigate the workflow failure:
These steps should help you pinpoint the cause of the failure and find related changes or issues.
|
Workflow Failure AnalysisLatest Failed Run
Last Successful Run
Jobs ComparisonBoth runs had similar job structures with completed statuses. Detailed job logs might reveal specific errors, but we need to examine the source code and commits to understand the failures. Code Changes & CommitsNo specific commit log or file diff was retrieved. It might be necessary to inspect commits between the successful and failed SHA manually to pinpoint changes. Issues & CorrelationsNo direct correlation with specific open issues or pull requests was found. Here's a list of open issues that may be relevant:
These issues could potentially relate to the workflow's failure, especially if recent code changes addressed these topics. Next Steps
Feel free to ask for more detailed inspection or specific job log retrieval!
|
|
||
```js wrap | ||
defAgent( | ||
"git", |
There was a problem hiding this comment.
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
throw new Error(`tool ${toolName} not found`) | ||
throw new Error( | ||
`multi tool ${toolName} not found in ${tools.map((t) => t.spec.name).join(", ")}` | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message thrown when a tool is not found could potentially leak sensitive information about the available tools in the system. Consider revising the error message to avoid exposing too much information.
generated by pr-review-commit
error_handling
@@ -996,22 +860,23 @@ defTool("git_last_tag", "Gets the last tag using git.", {}, async () => { | |||
|
|||
github workflows | |||
|
|||
Queries results from workflows in GitHub actions. | |||
Queries results from workflows in GitHub actions. Prefer using dffs to compare logs. |
There was a problem hiding this comment.
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
@@ -242,18 +242,18 @@ export async function expandTemplate( | |||
|
|||
if (status !== "success" || text === "") | |||
// cancelled | |||
return Object.freeze({ | |||
return { | |||
status, | |||
statusText, | |||
messages, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of Object.freeze has been removed which could potentially lead to mutation of the returned objects. If immutability is a requirement, consider reintroducing Object.freeze.
generated by pr-review-commit
object_freeze
@@ -1127,7 +992,7 @@ defTool( | |||
|
|||
defTool( | |||
"github_actions_job_logs_diff", |
There was a problem hiding this comment.
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
) | ||
return res | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The defAgent
function is quite complex and long. Consider breaking it down into smaller, more manageable functions to improve readability and maintainability.
generated by pr-review-commit
complex_function
This pull request refactors the existing
agent_fs
functionality into a newdefAgent
declaration, enhancing the structure and clarity of the code. It includes updates to the related documentation and types, ensuring that the new agent can be effectively utilized within the system. The changes aim to improve maintainability and usability for future development.agent_fs
tool seems to be replaced by a new interfacefs
. This is a significant change that would impact existing consumers. 🔄system.mdx
andsystem.agent_fs.genai.mjs
files, where theagent_fs
definitions are replaced byfs
.fs
tool appears to be more intuitive, with an apparent simplification of parameters and a potentially more straight-forward usage. 🧰runpromptcontext.ts
, a new functiondefAgent
is introduced. This function looks to facilitate the declaration of an LLM agent, including function handling and the definition of tools and systems. 🆕packages/core/src/prompt_template.d.ts
andpackages/core/src/prompt_type.ts
indicate this newdefAgent
function is added to the public API, hence being user facing. 🙋♂️DefAgentOptions
added to the public API, which appears to extendPromptGeneratorOptions
.Please note that actual impact would depend on projects using these features. Be sure to carefully test all functionalities after this update! 🧪