diff --git a/app.py b/app.py index 2e90e15..b3f543d 100644 --- a/app.py +++ b/app.py @@ -14,7 +14,6 @@ LOGGER = get_logger() - async def main(argv: list[str]) -> int: try: user_query = argv[1] diff --git a/book_db.py b/book_db.py index 0bb84f2..3953102 100644 --- a/book_db.py +++ b/book_db.py @@ -61,6 +61,6 @@ def call_function(name: str, args: str) -> Book | None | list[Book]: case "search": return search(args_dict["name"]) case "get": - return get(args_dict["book"]) + return get(args_dict["id"]) case _: raise ValueError(f"Unknown function: {name}") diff --git a/book_db_function_calling.aiconfig.json b/book_db_function_calling.aiconfig.json index 1c9fc60..119b391 100644 --- a/book_db_function_calling.aiconfig.json +++ b/book_db_function_calling.aiconfig.json @@ -1,8 +1,11 @@ { "name": "Book Finder", - "description": "Use OpenAI function calling to help recommend books", "schema_version": "latest", - "metadata": {}, + "metadata": { + "parameters": {}, + "models": {} + }, + "description": "Use OpenAI function calling to help recommend books", "prompts": [ { "name": "user_query_to_function_call", @@ -11,61 +14,62 @@ "model": { "name": "gpt-3.5-turbo", "settings": { - "model": "gpt-3.5-turbo", "functions": [ { - "name": "list", "description": "list queries books by genre, and returns a list of names of books", + "name": "list", "parameters": { - "type": "object", "properties": { "genre": { - "type": "string", "enum": [ "mystery", "nonfiction", "memoir", "romance", "historical" - ] + ], + "type": "string" } - } + }, + "type": "object" } }, { + "description": "search queries books by their name and returns a list of book names and their ids", "name": "search", - "description": "search queries books and returns a list", "parameters": { - "type": "object", "properties": { "name": { "type": "string" } - } + }, + "type": "object" } }, { + "description": "get returns a book's detailed information based on the id of the book. Note that this does not accept names, and only IDs, which you can get by using search.", "name": "get", - "description": "get returns a book's detailed information for a book.", "parameters": { - "type": "object", "properties": { - "book": { + "id": { "type": "string" } - } + }, + "type": "object" } } ], + "model": "gpt-3.5-turbo", "system_prompt": { - "role": "system", - "content": "Please use our book database, which you can access using functions to answer the following questions." + "content": "Please use our book database, which you can access using functions to answer the following questions.", + "role": "system" } } }, "parameters": {}, "remember_chat_context": false - } + }, + "outputs": [] }, { "name": "function_output_to_text_response", @@ -80,8 +84,9 @@ }, "parameters": {}, "remember_chat_context": false - } + }, + "outputs": [] } ], "$schema": "https://json.schemastore.org/aiconfig-1.0" -} +} \ No newline at end of file diff --git a/test_app.py b/test_app.py index f212282..b29e847 100644 --- a/test_app.py +++ b/test_app.py @@ -57,7 +57,7 @@ async def test_function_accuracy(): ( {"user_query": "ID isbn123"}, # - {"arguments": '{\n "book": "isbn123"\n}', "name": "get"}, + {"arguments": '{\n "id": "isbn123"\n}', "name": "get"}, ), ( {"user_query": "To kill a mockingbird"},