Open virologist opened 3 weeks ago
Hi @virologist, please install with pip install -U langchain-google-genai
Thanks for your response. I still get this error below. This error is looks like related to the compatibility of the Pydantic V2 version.
/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_config.py:341: UserWarning: Valid config keys have changed in V2:
* 'allow_population_by_field_name' has been renamed to 'populate_by_name'
warnings.warn(message, UserWarning)
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/nn/miniconda3/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send) # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/middleware/errors.py", line 151, in __call__
await self.app(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in __call__
await self.app(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/routing.py", line 754, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/routing.py", line 774, in app
await route.handle(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/routing.py", line 371, in handle
await self.app(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/routing.py", line 96, in app
await wrap_app_handling_exceptions(app, session)(scope, receive, send)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/starlette/routing.py", line 94, in app
await func(session)
File "/Users/nn/miniconda3/lib/python3.12/site-packages/fastapi/routing.py", line 367, in app
await dependant.call(**values)
File "/Users/nn/Library/gpt-researcher/backend/server/server.py", line 136, in websocket_endpoint
await handle_websocket_communication(websocket, manager)
File "/Users/nn/Library/gpt-researcher/backend/server/server_utils.py", line 117, in handle_websocket_communication
await handle_start_command(websocket, data, manager)
File "/Users/nn/Library/gpt-researcher/backend/server/server_utils.py", line 28, in handle_start_command
report = await manager.start_streaming(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/Library/gpt-researcher/backend/server/websocket_manager.py", line 61, in start_streaming
report = await run_agent(task, report_type, report_source, source_urls, tone, websocket, headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/Library/gpt-researcher/backend/server/websocket_manager.py", line 95, in run_agent
report = await researcher.run()
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/Library/gpt-researcher/backend/report_type/basic_report/basic_report.py", line 30, in run
researcher = GPTResearcher(
^^^^^^^^^^^^^^
File "/Users/nn/Library/gpt-researcher/gpt_researcher/agent.py", line 76, in __init__
self.memory = Memory(
^^^^^^^
File "/Users/nn/Library/gpt-researcher/gpt_researcher/memory/embeddings.py", line 40, in __init__
from langchain_openai import OpenAIEmbeddings
File "/Users/nn/miniconda3/lib/python3.12/site-packages/langchain_openai/__init__.py", line 1, in <module>
from langchain_openai.chat_models import AzureChatOpenAI, ChatOpenAI
File "/Users/nn/miniconda3/lib/python3.12/site-packages/langchain_openai/chat_models/__init__.py", line 1, in <module>
from langchain_openai.chat_models.azure import AzureChatOpenAI
File "/Users/nn/miniconda3/lib/python3.12/site-packages/langchain_openai/chat_models/azure.py", line 41, in <module>
from langchain_openai.chat_models.base import BaseChatOpenAI
File "/Users/nn/miniconda3/lib/python3.12/site-packages/langchain_openai/chat_models/base.py", line 353, in <module>
class BaseChatOpenAI(BaseChatModel):
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 224, in __new__
complete_model_class(
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 577, in complete_model_class
schema = cls.__get_pydantic_core_schema__(cls, handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/main.py", line 671, in __get_pydantic_core_schema__
return handler(source)
^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__
schema = self._handler(source_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 655, in generate_schema
schema = self._generate_schema_inner(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 924, in _generate_schema_inner
return self._model_schema(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 739, in _model_schema
{k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 1115, in _generate_md_field_schema
common_field = self._common_field_schema(name, field_info, decorators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 1308, in _common_field_schema
schema = self._apply_annotations(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 2107, in _apply_annotations
schema = get_inner_schema(source_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__
schema = self._handler(source_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 2088, in inner_handler
schema = self._generate_schema_inner(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 929, in _generate_schema_inner
return self.match_type(obj)
^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 1029, in match_type
return self._match_generic_type(obj, origin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 1058, in _match_generic_type
return self._union_schema(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 1378, in _union_schema
choices.append(self.generate_schema(arg))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 657, in generate_schema
metadata_js_function = _extract_get_pydantic_json_schema(obj, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nn/miniconda3/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py", line 2447, in _extract_get_pydantic_json_schema
raise PydanticUserError(
pydantic.errors.PydanticUserError: The `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` instead in class `SecretStr`.
For further information visit https://errors.pydantic.dev/2.9/u/custom-json-schema
I guess you are using OpenAI embedding? You probably need to update langchain-openai to the latest version
Describe the bug error and log are below
To Reproduce Steps to reproduce the behavior:
Expected behavior should run properly
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): **- OS: Mac M1 latest