mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-01 10:54:15 +00:00
lint
This commit is contained in:
parent
ea0d921e72
commit
3c8328e9b7
@ -2197,7 +2197,8 @@ def _resize(width: int, height: int) -> Tuple[int, int]:
|
|||||||
|
|
||||||
def _update_schema_with_optional_fields(input_dict: dict) -> dict:
|
def _update_schema_with_optional_fields(input_dict: dict) -> dict:
|
||||||
"""Convert optional fields to required fields allowing 'null' type."""
|
"""Convert optional fields to required fields allowing 'null' type."""
|
||||||
def _update_properties(schema: dict):
|
|
||||||
|
def _update_properties(schema: dict) -> None:
|
||||||
if schema.get("type") != "object":
|
if schema.get("type") != "object":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -851,17 +851,19 @@ def test__convert_to_openai_response_format() -> None:
|
|||||||
assert expected == actual
|
assert expected == actual
|
||||||
|
|
||||||
## JSON Schema
|
## JSON Schema
|
||||||
class Entity(BaseModel):
|
class EntityModel(BaseModel):
|
||||||
"""Extracted entity."""
|
"""Extracted entity."""
|
||||||
|
|
||||||
animal: str = Field(description="The animal")
|
animal: str = Field(description="The animal")
|
||||||
color: Optional[str] = Field(default=None, description="The color")
|
color: Optional[str] = Field(default=None, description="The color")
|
||||||
|
|
||||||
actual = _convert_to_openai_response_format(Entity.model_json_schema(), strict=True)
|
actual = _convert_to_openai_response_format(
|
||||||
|
EntityModel.model_json_schema(), strict=True
|
||||||
|
)
|
||||||
expected = {
|
expected = {
|
||||||
"type": "json_schema",
|
"type": "json_schema",
|
||||||
"json_schema": {
|
"json_schema": {
|
||||||
"name": "Entity",
|
"name": "EntityModel",
|
||||||
"description": "Extracted entity.",
|
"description": "Extracted entity.",
|
||||||
"strict": True,
|
"strict": True,
|
||||||
"schema": {
|
"schema": {
|
||||||
|
Loading…
Reference in New Issue
Block a user