mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-01 02:43:37 +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:
|
||||
"""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":
|
||||
return
|
||||
|
||||
|
@ -851,17 +851,19 @@ def test__convert_to_openai_response_format() -> None:
|
||||
assert expected == actual
|
||||
|
||||
## JSON Schema
|
||||
class Entity(BaseModel):
|
||||
class EntityModel(BaseModel):
|
||||
"""Extracted entity."""
|
||||
|
||||
animal: str = Field(description="The animal")
|
||||
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 = {
|
||||
"type": "json_schema",
|
||||
"json_schema": {
|
||||
"name": "Entity",
|
||||
"name": "EntityModel",
|
||||
"description": "Extracted entity.",
|
||||
"strict": True,
|
||||
"schema": {
|
||||
|
Loading…
Reference in New Issue
Block a user