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

The validation of tools within OpenAIAssistantRunnable.create_assistant does not account for {"type": "code_interpreter"}. #19057

Open
5 tasks done
fmyblack opened this issue Mar 14, 2024 · 2 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🔌: openai Primarily related to OpenAI integrations Ɑ: Runnables Related to Runnables

Comments

@fmyblack
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_experimental.openai_assistant import OpenAIAssistantRunnable

interpreter_assistant = OpenAIAssistantRunnable.create_assistant(
    name="langchain assistant",
    instructions="You are a personal math tutor. Write and run code to answer math questions.",
    tools=[{"type": "code_interpreter"}],
    model="gpt-4-1106-preview"
)
output = interpreter_assistant.invoke({"content": "What's 10 - 4 raised to the 2.7"})

Error Message and Stack Trace (if applicable)

File "xxx/t.py", line 43, in
interpreter_assistant = OpenAIAssistantRunnable.create_assistant(
File "xxx/site-packages/langchain/agents/openai_assistant/base.py", line 213, in create_assistant
tools=[convert_to_openai_tool(tool) for tool in tools], # type: ignore
File "xxx/langchain/agents/openai_assistant/base.py", line 213, in
tools=[convert_to_openai_tool(tool) for tool in tools], # type: ignore
File "xxx/langchain_core/utils/function_calling.py", line 329, in convert_to_openai_tool
function = convert_to_openai_function(tool)
File "xxx/langchain_core/utils/function_calling.py", line 304, in convert_to_openai_function
raise ValueError(
ValueError: Unsupported function

{'type': 'code_interpreter'}

Functions must be passed in as Dict, pydantic.BaseModel, or Callable. If they're a dict they must either be in OpenAI function format or valid JSON schema with top-level 'title' and 'description' keys.

Description

I used the example code, but it threw an error when executed.

example code from https://python.langchain.com/docs/modules/agents/agent_types/openai_assistants#using-only-openai-tools

System Info

$ pip list | grep langchain
langchain 0.1.12
langchain-community 0.0.28
langchain-core 0.1.31
langchain-openai 0.0.8
langchain-text-splitters 0.0.1

@dosubot dosubot bot added Ɑ: Runnables Related to Runnables 🔌: openai Primarily related to OpenAI integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Mar 14, 2024
@fmyblack fmyblack changed the title The validation of tools within OpenAIAssistantRunnable.create_assistant does not account for {"type": "code_interpreter"}. The validation of tools within OpenAIAssistantRunnable.create_assistant does not account for {"type": "code_interpreter"}. Mar 14, 2024
@chatgptguru
Copy link

Same here, I am also facing this issue in latest langchain version, it was working fine last week. Any update?
Thanks in advance

ccurme added a commit that referenced this issue Mar 22, 2024
- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
#18935
- **Issue:** #19057
@ccurme
Copy link
Collaborator

ccurme commented Mar 22, 2024

Should be closed in #19081

rahul-trip pushed a commit to daxa-ai/langchain that referenced this issue Mar 27, 2024
…i#19081)

- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
langchain-ai#18935
- **Issue:** langchain-ai#19057
bechbd pushed a commit to bechbd/langchain that referenced this issue Mar 29, 2024
…i#19081)

- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
langchain-ai#18935
- **Issue:** langchain-ai#19057
gkorland pushed a commit to FalkorDB/langchain that referenced this issue Mar 30, 2024
…i#19081)

- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
langchain-ai#18935
- **Issue:** langchain-ai#19057
chrispy-snps pushed a commit to chrispy-snps/langchain that referenced this issue Mar 30, 2024
…i#19081)

- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
langchain-ai#18935
- **Issue:** langchain-ai#19057
chrispy-snps pushed a commit to chrispy-snps/langchain that referenced this issue Mar 30, 2024
…i#19081)

- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
langchain-ai#18935
- **Issue:** langchain-ai#19057
hinthornw pushed a commit that referenced this issue Apr 26, 2024
- **Description:** OpenAI assistants support some pre-built tools (e.g.,
`"retrieval"` and `"code_interpreter"`) and expect these as `{"type":
"code_interpreter"}`. This may have been upset by
#18935
- **Issue:** #19057
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 🔌: openai Primarily related to OpenAI integrations Ɑ: Runnables Related to Runnables
Projects
None yet
Development

No branches or pull requests

3 participants