Skip to content

The agent engineering platform.

added support for different types in ResponseSchema class (#5789)

SvMax92b87c2fec17
diff --git a/langchain/output_parsers/structured.py b/langchain/output_parsers/structured.py
index 9afaf6cdac..a7b5c3910d 100644
--- a/langchain/output_parsers/structured.py
+++ b/langchain/output_parsers/structured.py
@@ -14,11 +14,12 @@ line_template = '\t"{name}": {type} // {description}'
class ResponseSchema(BaseModel):
name: str
description: str
+ type: str = "string"
def _get_sub_string(schema: ResponseSchema) -> str:
return line_template.format(
- name=schema.name, description=schema.description, type="string"
+ name=schema.name, description=schema.description, type=schema.type
)