Closed nadworny closed 1 month ago
this works for me
this works for me
@liugddx which GPT model do you use? What are your python packages versions?
I am facing the same problem. Following the guide (https://python.langchain.com/docs/use_cases/extraction/how_to/examples)
class Person(BaseModel):
# ^ Doc-string for the entity Person.
# This doc-string is sent to the LLM as the description of the schema Person,
# and it can help to improve extraction results.
# Note that:
# 1. Each field is an `optional` -- this allows the model to decline to extract it!
# 2. Each field has a `description` -- this description is used by the LLM.
# Having a good description can help improve extraction results.
name: Optional[str] = Field(..., description="The name of the person")
hair_color: Optional[str] = Field(
..., description="The color of the peron's eyes if known"
)
height_in_meters: Optional[str] = Field(..., description="Height in METERs")
runnable = prompt | personal.with_structured_output(
schema=Person,
method="function_calling",
include_raw=False)
runnable_azurechat_openai = prompt | azure_chat.with_structured_output(
schema=Person,
method="function_calling",
include_raw=False,
)
"name": "OutputParserException",
"message": "Function Person arguments:\n\n({\n name: \"Harrison\",\n hair_color: \"black\",\n height_in_meters: null\n})\n\nare not valid JSON. Received JSONDecodeError Expecting value: line 1 column 1 (char 0)",```
I facing with same problem
I am also facing the same problem with AzureOpenAI
AlphaCodium paper shows that using yaml instead of json for code generation is better. Would be great if someone updated this library to use yaml. Any known issues with doing that? See screenshot below:
Checked other resources
Example Code
the following notebook doesn't work for me: https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb
when executing this code:
Error Message and Stack Trace (if applicable)
Description
Using the following structured output code:
I'm using
AzureChatOpenAI
as LLM.System Info
langchain==0.0.352 langchain-community==0.0.5 langchain-core==0.1.2
pyproject deps: python = "^3.11" python-dotenv = "^1.0.1" langchain-community = "^0.0.29" tiktoken = "^0.6.0" langchain-openai = "^0.1.1" langchainhub = "^0.1.15" chromadb = "^0.4.24" langchain = "^0.1.13" youtube-transcript-api = "^0.6.2" pytube = "^15.0.0" httpx = "^0.27.0" h11 = "^0.14.0" distro = "^1.9.0" pydantic = ">2"