Skip to content

Commit

Permalink
remove title and props
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl committed Jul 31, 2023
1 parent fae7254 commit 0c4123c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions openai_function_call/function_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def __init__(self, func: Callable) -> None:
if k not in ("v__duplicate_kwargs", "args", "kwargs")
}
parameters["required"] = sorted(
k for k, v in parameters["properties"].items()
if not "default" in v
k for k, v in parameters["properties"].items() if not "default" in v
)
_remove_a_key(parameters, "additionalProperties")
_remove_a_key(parameters, "title")
self.openai_schema = {
"name": self.func.__name__,
"description": self.func.__doc__,
Expand Down Expand Up @@ -132,15 +132,16 @@ def openai_schema(cls):
k: v for k, v in schema.items() if k not in ("title", "description")
}
parameters["required"] = sorted(
k for k, v in parameters["properties"].items()
if not "default" in v
k for k, v in parameters["properties"].items() if not "default" in v
)

if "description" not in schema:
schema[
"description"
] = f"Correctly extracted `{cls.__name__}` with all the required parameters with correct types"

_remove_a_key(parameters, "additionalProperties")
_remove_a_key(parameters, "title")
return {
"name": schema["title"],
"description": schema["description"],
Expand Down

0 comments on commit 0c4123c

Please sign in to comment.