Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Feb 15, 2024
1 parent 541fc3f commit d556fe5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libs/partners/openai/langchain_openai/chat_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def with_structured_output(
If schema is a dict then _DictOrPydantic is a dict.
Function-calling, Pydantic schema example (method="function-calling", return_type="parsed"):
Function-calling, Pydantic schema example (method="function_calling", return_type="parsed"):
.. code-block:: python
from langchain_openai import ChatOpenAI
Expand All @@ -829,7 +829,7 @@ class AnswerWithJustification(BaseModel):
justification: str
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
structured_llm = llm.with_output_format(AnswerWithJustification)
structured_llm = llm.with_structured_output(AnswerWithJustification)
structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers")
Expand All @@ -838,7 +838,7 @@ class AnswerWithJustification(BaseModel):
# justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'
# )
Function-calling, Pydantic schema example (method="function-calling", return_type="all"):
Function-calling, Pydantic schema example (method="function_calling", return_type="all"):
.. code-block:: python
from langchain_openai import ChatOpenAI
Expand All @@ -850,7 +850,7 @@ class AnswerWithJustification(BaseModel):
justification: str
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
structured_llm = llm.with_output_format(AnswerWithJustification, return_type="all")
structured_llm = llm.with_structured_output(AnswerWithJustification, return_type="all")
structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers")
# -> {
Expand All @@ -859,7 +859,7 @@ class AnswerWithJustification(BaseModel):
# 'parsing_error': None
# }
Function-calling, dict schema example (method="function-calling", return_type="parsed"):
Function-calling, dict schema example (method="function_calling", return_type="parsed"):
.. code-block:: python
from langchain_openai import ChatOpenAI
Expand All @@ -873,7 +873,7 @@ class AnswerWithJustification(BaseModel):
dict_schema = convert_to_openai_tool(AnswerWithJustification)
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
structured_llm = llm.with_output_format(dict_schema)
structured_llm = llm.with_structured_output(dict_schema)
structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers")
# -> {
Expand Down

0 comments on commit d556fe5

Please sign in to comment.