Skip to content

Commit

Permalink
update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-gee committed Oct 30, 2023
1 parent 927bc83 commit b65c683
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/webtranspose/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,16 @@ def transform_schema(self, schema: dict) -> dict:
properties = {}
for key, value in schema.items():
if isinstance(value, dict):
if "type" in value:
if "type" in value and value["type"] == "array":
properties[key] = {
"type": "array",
"items": {
"type": "object",
"properties": self.transform_schema(value["items"]),
},
"required": list(value["items"].keys()),
}
elif "type" in value:
properties[key] = value
else:
properties[key] = self.transform_schema(value)
Expand All @@ -145,4 +154,5 @@ def transform_schema(self, schema: dict) -> dict:
"type": value,
"description": key,
}

return properties

0 comments on commit b65c683

Please sign in to comment.