-
Notifications
You must be signed in to change notification settings - Fork 35
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
how do actions work? #1
Comments
Here is a quick summary:
Here is more information on the different concepts: Action Step Tool |
wow thanks for the detailed reply! so this is how the system this side functions and handles calling the tools. this is code that I can probably follow. But I'm still not clear how the decision to even include a tool is made, in terms of how the openAI model decides whether to include the tool's boilerplate in it's response? Is this based on sending a pre-prompt/system prompt which is the tool description, and then just hoping the model chooses the tool on relevant occasions, and populates the tools boilerplate with exactly what it wants to lookup? if this calling the tools code / processing the result is all done in your system, does that allow the openAI model to do anything with the tools output? Is it fed back to that agent somehow? eg
if it does use the tool to do a look up, how does it know the result? |
Yes, the LLM chooses the tool based on the prompt and provides the arguments as well. The results are then fed into the prompt for the next step (iteration). |
so the LLM response is smart enough to parse this {
"action": "an action",
"param1": "a parameter value",
"param2": "another parameter value"
} and replace "an action" with eg How is the result of the action (eg reading a wikipedia page) embedded into the bots response? |
The agent runs a loop until it's done - it does not immediately respond to the user. The output that you are seeing in the console is just an example from observing the agent run. I plan to add examples of other environments as well. You can find more details about loops here:
On each iteration of a loop with GenerateNextStepLoop, a prompt is sent to the LLM. Results from previous action steps are included using the resultFormatter associated with the action:
You can find the default result formatters in the actions (you can change them to your liking when you set up your agent), e.g.: https://github.com/lgrammel/gptagent.js/blob/main/packages/agent/src/tool/programmable-google-search-engine/ProgrammableGoogleSearchEngineTool.ts#L26 |
I've added some basic documentation: https://js-agent.ai/docs/intro |
ref https://twitter.com/lgrammel/status/1645840202055680013
if i use this framework to query openAI GPT model, how is output routed to a plugin vs just sending the openAI response?
since openAI doesn't know about these client side plugins, how do the two interact?
referencing:
I see
so does openAI API respond with a block of text with
action: "an action",
where 'an action' is something chatGPT would like executed
then client side the Action plugin will parse the openAI response and make any needed API calls requested from the action?
So looking at an example action
https://github.com/lgrammel/gptagent.js/blob/main/packages/agent/src/action/tool/summarize-webpage/SummarizeWebpageAction.ts
has
description = "Summarize a webpage considering a topic.",
so openAI would be initialized with
``
You can perform the following actions using ${
this.format.description
}:
${this.describeActions()}
You can perform the following actions using [Summarize a webpage considering a topic]
The text was updated successfully, but these errors were encountered: