Skip to content
← Back to activity

Immutable solution version

openai has no ChatCompletion attribute, this is likely due to an old version of the openai package.

Version 1Sign in to save

Complete solution

A practical guide for LangChain. This error means your langchain version predates the OpenAI v1 client. Upgrade langchain to a release that supports openai>=1.0; one confirmed-good combo from the thread is openai==1.2.0 with langchain==0.0.332 (0.0.333 works too), and several users fixed it with a plain fresh install.

The problem

Issue langchain-ai/langchain#12949 (closed, 34 comments): ### System Info Langchain v0.0.323 Openai v1.0.1 (latest) Python v3.11.6 ### Who can help? @hwchase17 @agola11 ### Information - [ ] The official example notebooks/scripts - [X] My own modified scripts ### Related Components - [X] LLMs/Chat Models - [ ] Embedding Models - [ ] Prompts / Prompt Templates / Prompt Selectors - [ ] Output Parsers - [ ] Document Loaders - [ ] Vector Stores / Retrievers - [ ] Memory - [ ] Agents / Agent Executors - [ ] Tools / Toolkits - [ ] Chains - [ ] Callbacks/Tracing - [ ] Async ### Reproduction ``` from...

The fix

This error means your langchain version predates the OpenAI v1 client. Upgrade langchain to a release that supports openai>=1.0; one confirmed-good combo from the thread is openai==1.2.0 with langchain==0.0.332 (0.0.333 works too), and several users fixed it with a plain fresh install. Whatever you do, upgrade the two together: mixing a new openai with an old langchain (or vice versa) is what produces this.

Notes

Thread: https://github.com/langchain-ai/langchain/issues/12949. Verified against the closed issue and the maintainer/accepted answer there.

Evidence

In https://github.com/langchain-ai/langchain/issues/12949, the reporter asked: Issue langchain-ai/langchain#12949 (closed, 34 comments): ### System Info Langchain v0.0.323 Openai v1.0.1 (latest) Python v3.11.6 ### Who can help? @hwchase17 @agola11 ### Information - [ ] The official example notebooks/scripts - [X] My own modified scripts ### Related Components - [X] LLMs/Chat Models - [ ] Embedding Models - [ ] Prompts / Prompt Templates / Prompt Selectors - [ ] Output Parsers - [ ] Document Loaders - [ ] Vector Stores / Retrievers - [ ] Memory - [ ] Agents / Agent Executors - [ ] Tools / Toolkits - [ ] Chains - [ ] Callbacks/Tracing - [ ] Async ### Reproduction ``` from... The verified answer: This error means your langchain version predates the OpenAI v1 client. Upgrade langchain to a release that supports openai>=1.0; one confirmed-good combo from the thread is openai==1.2.0 with langchain==0.0.332 (0.0.333 works too), and several users fixed it with a plain fresh install. Whatever you do, upgrade the two together: mixing a new openai with an old langchain (or vice versa) is what produces this. Source thread: https://github.com/langchain-ai/langchain/issues/12949

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_gQ08Zr0gi8DhrapxIK_cIg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">openai has no ChatCompletion attribute, this is likely due to an old version of the openai package. <span>— Vectle</span></a>