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

Error while using OpenAI model with "parallel_tool_calls" #25357

Open
5 tasks done
qibinzhou-conveyor opened this issue Aug 13, 2024 · 5 comments
Open
5 tasks done

Error while using OpenAI model with "parallel_tool_calls" #25357

qibinzhou-conveyor opened this issue Aug 13, 2024 · 5 comments
Assignees
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature investigate 🔌: openai Primarily related to OpenAI integrations

Comments

@qibinzhou-conveyor
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="GPT-4").with_structured_output(
    schema={
        ...
    },
)

model.invoke(prompt)

Error Message and Stack Trace (if applicable)

Error code: 400 - {'error': {'message': "Unknown parameter: 'parallel_tool_calls'.", 'type': 'invalid_request_error', 'param': 'parallel_tool_calls', 'code': 'unknown_parameter'}}

Description

I'm using OpenAI model with structured output. I'm experiencing flaky error with the error message above. Running with the same model and the same problem, sometimes it raises the error above, while sometimes it just goes through.

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 23.5.0: Wed May 1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031
Python Version: 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:07:17) [Clang 14.0.6 ]

Package Information

langchain_core: 0.2.29
langchain: 0.2.6
langchain_community: 0.2.6
langsmith: 0.1.98
langchain_openai: 0.1.13
langchain_text_splitters: 0.2.2

Optional packages not installed

langgraph
langserve

Other Dependencies

aiohttp: 3.10.1
async-timeout: Installed. No version info available.
dataclasses-json: 0.6.7
jsonpatch: 1.33
numpy: 1.26.4
openai: 1.40.1
orjson: 3.10.6
packaging: 24.1
pydantic: 2.8.2
PyYAML: 6.0.2
requests: 2.32.3
SQLAlchemy: 2.0.32
tenacity: 8.5.0
tiktoken: 0.7.0
typing-extensions: 4.12.2

@langcarl langcarl bot added the investigate label Aug 13, 2024
@dosubot dosubot bot added 🔌: openai Primarily related to OpenAI integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Aug 13, 2024
@uglyrobot
Copy link

From OpenAI:
Structured Outputs is not compatible with parallel function calls. When a parallel function call is generated, it may not match supplied schemas. Set parallel_tool_calls: false to disable parallel function calling.

@qibinzhou-conveyor
Copy link
Author

From OpenAI: Structured Outputs is not compatible with parallel function calls. When a parallel function call is generated, it may not match supplied schemas. Set parallel_tool_calls: false to disable parallel function calling.

I don't think that's the problem. Langchain set parallel_tool_calls as False. Also the err msg complaints about the existence of the field, not the value

@maximilianboth
Copy link

I currently have exactly the same problem. Is there a solution for this in the meantime? Thank you very much!

@thamid
Copy link

thamid commented Aug 26, 2024

Any update on this? Thanks

@efriis
Copy link
Member

efriis commented Aug 30, 2024

Hey there! I can't reproduce with the following code

from langchain_openai import ChatOpenAI
from langchain_core.pydantic_v1 import BaseModel

class Person(BaseModel):
    """A Person"""
    name: str
    age: int

ChatOpenAI(model="gpt-4o").with_structured_output(schema=Person.schema()).invoke('john 1')

Could someone post their code that reproduces this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature investigate 🔌: openai Primarily related to OpenAI integrations
Projects
None yet
Development

No branches or pull requests

5 participants