-
Notifications
You must be signed in to change notification settings - Fork 2k
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
handleLLMNewToken
called with empty tokens when using function calling
#1640
Comments
Here are some of the ideas: Single callbackcallbacks: [
{
handleLLMNewFunctionCall(function_call: {name: string;args:string}) {
/*
function_call = {
name: "xxx",
args: 'yyy'
}
*/
},
}
] Separate callbacks for function name and argumentcallbacks: [
{
handleLLMNewFunctionCallName(function_call_name: string) {
/*
function_call_name = "xxx"
*/
},
handleLLMNewFunctionCallArgs(function_call_args: string) {
/*
function_call_args = "yyy"
*/
}
}
] From my observations, looks like OpenAI always emits entire |
Looks like a PR was submitted #2025 |
Hi, @gramliu! I'm Dosu, and I'm helping the langchainjs team manage their backlog. I wanted to let you know that we are marking this issue as stale. Based on my understanding, the issue you reported is related to the Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the langchainjs repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your contribution to langchainjs! |
When calling
ChatOpenAI.predictMessages
with an OpenAI function call specified, thehandleLLMNewToken
callback is repeatedly called with empty tokens. This is likely because when OpenAI pushes new chunks to the HTTP event-stream, the structure of the response data is slightly different.For normal text responses, the schema of a
choice
follows:With function calling, however, it now looks like:
Edit: This does seem to be the case: see
The text was updated successfully, but these errors were encountered: