Skip to content

Error PydanticInvalidForJsonSchema while using ChatOCIGenAI with Langchaing 1.0 deepagent #82

@avianabr

Description

@avianabr

I got the following error while trying to use ChatOCIGentAI with langchain 1.0 deepagent

Exception has occurred: PydanticInvalidForJsonSchema
Cannot generate a JsonSchema for core_schema.CallableSchema

For further information visit https://errors.pydantic.dev/2.12/u/invalid-for-json-schema
File "C:\Users\opc\langgraph-test\src\agent\graph.py", line 24, in
result = agent.invoke({"messages": [{"role": "human", "content": "Tell me a joke about oracle stock price"}]})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.CallableSchema

For further information visit https://errors.pydantic.dev/2.12/u/invalid-for-json-schema

code to reproduce the error

from typing import Literal
from deepagents import create_deep_agent
from langchain_oci import ChatOCIGenAI

oci = ChatOCIGenAI(
model_id="meta.llama-3.3-70b-instruct",
service_endpoint="https://inference.generativeai.sa-saopaulo-1.oci.oraclecloud.com",
compartment_id="ocid1.compartment.oc1..*******",
auth_type="INSTANCE_PRINCIPAL",
is_stream=True,
model_kwargs={"temperature": 0},
)

#works fine
result = oci.invoke("Hello, world!")

agent = create_deep_agent(
model=oci,
)

triggers exception

result = agent.invoke({"messages": [{"role": "human", "content": "Tell me a joke about oracle stock price"}]})

Print the agent's response

print(result["messages"][-1].content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions