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

'socket_options' type error in langchain crash course code. #15

Open
theraghavjuneja opened this issue Jun 9, 2024 · 1 comment
Open

Comments

@theraghavjuneja
Copy link

ValidationError: 1 validation error for OpenAI
root
ConnectionPool.init() got an unexpected keyword argument 'socket_options' (type=type_error)

The code snippet looks like
import os
from dotenv import load_dotenv
import openai
from langchain import OpenAI,ConversationChain, LLMChain, PromptTemplate
load_dotenv()
openai_api_key = os.getenv('OPENAI_API_KEY')
llm=OpenAI(api_key=openai_api_key)

The exact stack of error is:

ValidationError Traceback (most recent call last)
Cell In[16], line 1
----> 1 llm=OpenAI(api_key=openai_api_key)

File c:\Users\Charanjeet Juneja\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_core_api\deprecation.py:171, in deprecated..deprecate..finalize..warn_if_direct_instance(self, *args, **kwargs)
169 warned = True
170 emit_warning()
--> 171 return wrapped(self, *args, **kwargs)

File c:\Users\Charanjeet Juneja\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_core\load\serializable.py:107, in Serializable.init(self, **kwargs)
106 def init(self, **kwargs: Any) -> None:
--> 107 super().init(**kwargs)
108 self._lc_kwargs = kwargs

File c:\Users\Charanjeet Juneja\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic\v1\main.py:341, in BaseModel.init(pydantic_self, **data)
339 values, fields_set, validation_error = validate_model(pydantic_self.class, data)
340 if validation_error:
--> 341 raise validation_error
342 try:
343 object_setattr(pydantic_self, 'dict', values)

ValidationError: 1 validation error for OpenAI
root
ConnectionPool.init() got an unexpected keyword argument 'socket_options' (type=type_error)

@Vishal-Desai17
Copy link

try it..
pip install langchain_openai
from langchain_openai import OpenAI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants