-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
OpenAI Agent returning structured output has type errors #3774
Comments
🤖 Hey there, @garrettg123! Good to see you around again. Let's dive into this challenge together, shall we? It seems like you're encountering type errors due to a mismatch between the expected types and the ones you're providing. Let's try to address these issues one by one.
const myFunction: FunctionDefinition = {
name: 'myFunction',
description: 'My function',
parameters: {
param1: 'value1',
param2: 'value2',
// ...
},
// ...
}; Then, you can use this function in the const llmWithTools = llm.bind({
functions: [
...tools.map(tool => formatToOpenAIFunction(tool)),
responseOpenAIFunction,
myFunction,
],
});
const runnableAgent = RunnableSequence.from([
{
input: (i: { input: string; steps: Array<AgentStep> }) => i,
agent_scratchpad: (i: { input: string; steps: Array<AgentStep> }) =>
formatForOpenAIFunctions(i.steps),
},
prompt,
llmWithTools,
structuredOutputParser,
]); I hope this helps! If you're still encountering issues, could you please provide more information about the Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Thanks for the heads up, am looking into it now CC @bracesproul |
Following the exact guide at https://js.langchain.com/docs/modules/agents/how_to/agent_structured, these errors come up:
for
and then
for
The text was updated successfully, but these errors were encountered: