Skip to content

Commit

Permalink
prevent title from being used in schema
Browse files Browse the repository at this point in the history
  • Loading branch information
minimaxir committed Jul 24, 2023
1 parent c7aa79b commit 6cfc43d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simpleaichat/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def prepare_request(

def schema_to_function(self, schema: Any):
assert schema.__doc__, f"{schema.__name__} is missing a docstring."
assert (
"title" not in schema.__fields__.keys()
), "`title` is a reserved keyword and cannot be used as a field name."
schema_dict = schema.model_json_schema()
remove_a_key(schema_dict, "title")

Expand Down

0 comments on commit 6cfc43d

Please sign in to comment.