From f956421bb0f20e62e2248df33f645fdc76c42e2f Mon Sep 17 00:00:00 2001 From: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:28:45 -0500 Subject: [PATCH] Sync wiht v0.0.14 Changes --- .gitignore | 2 + openapi.json | 144 ++++++++++++++++++++++++------------------ openapi.stainless.yml | 2 +- transform.py | 10 +++ 4 files changed, 94 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index e43b0f9..a84619c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .DS_Store +openapi-new.json +output.json diff --git a/openapi.json b/openapi.json index 7c49242..b692054 100644 --- a/openapi.json +++ b/openapi.json @@ -14,7 +14,7 @@ "identifier": "AGPL-3.0-only", "url": "https://github.com/plastic-labs/honcho/blob/main/LICENSE" }, - "version": "0.0.13" + "version": "0.0.14" }, "servers": [ { @@ -31,7 +31,7 @@ "get": { "tags": ["apps"], "summary": "Get App", - "description": "Get an App by ID\n\nArgs:\n app_id (str): The ID of the app\n\nReturns:\n schemas.App: App object", + "description": "Get an App by ID", "operationId": "get_app_v1_apps__app_id__get", "security": [ { @@ -76,7 +76,7 @@ "put": { "tags": ["apps"], "summary": "Update App", - "description": "Update an App\n\nArgs:\n app_id (str): The ID of the app to update\n app (schemas.AppUpdate): The App object containing any new metadata\n\nReturns:\n schemas.App: The App object of the updated App", + "description": "Update an App", "operationId": "update_app_v1_apps__app_id__put", "security": [ { @@ -133,7 +133,7 @@ "get": { "tags": ["apps"], "summary": "Get App By Name", - "description": "Get an App by Name\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", + "description": "Get an App by Name", "operationId": "get_app_by_name_v1_apps_name__name__get", "security": [ { @@ -180,7 +180,7 @@ "post": { "tags": ["apps"], "summary": "Create App", - "description": "Create an App\n\nArgs:\n app (schemas.AppCreate): The App object containing any metadata\n\nReturns:\n schemas.App: Created App object", + "description": "Create a new App", "operationId": "create_app_v1_apps_post", "requestBody": { "content": { @@ -226,7 +226,7 @@ "get": { "tags": ["apps"], "summary": "Get Or Create App", - "description": "Get or Create an App\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", + "description": "Get or Create an App", "operationId": "get_or_create_app_v1_apps_get_or_create__name__get", "security": [ { @@ -273,7 +273,7 @@ "post": { "tags": ["users"], "summary": "Create User", - "description": "Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Created User object", + "description": "Create a new User", "operationId": "create_user_v1_apps__app_id__users_post", "security": [ { @@ -330,7 +330,7 @@ "post": { "tags": ["users"], "summary": "Get Users", - "description": "Get All Users for an App\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n\nReturns:\n list[schemas.User]: List of User objects", + "description": "Get All Users for an App", "operationId": "get_users_v1_apps__app_id__users_list_post", "security": [ { @@ -424,7 +424,7 @@ "get": { "tags": ["users"], "summary": "Get User By Name", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", + "description": "Get a User by name", "operationId": "get_user_by_name_v1_apps__app_id__users_name__name__get", "security": [ { @@ -480,7 +480,7 @@ "get": { "tags": ["users"], "summary": "Get User", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", + "description": "Get a User by ID", "operationId": "get_user_v1_apps__app_id__users__user_id__get", "security": [ { @@ -534,7 +534,7 @@ "put": { "tags": ["users"], "summary": "Update User", - "description": "Update a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Updated User object", + "description": "Update a User's name and/or metadata", "operationId": "update_user_v1_apps__app_id__users__user_id__put", "security": [ { @@ -600,7 +600,7 @@ "get": { "tags": ["users"], "summary": "Get Or Create User", - "description": "Get or Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", + "description": "Get a User or create a new one by the input name", "operationId": "get_or_create_user_v1_apps__app_id__users_get_or_create__name__get", "security": [ { @@ -656,7 +656,7 @@ "post": { "tags": ["sessions"], "summary": "Get Sessions", - "description": "Get All Sessions for a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Session]: List of Session objects", + "description": "Get All Sessions for a User", "operationId": "get_sessions_v1_apps__app_id__users__user_id__sessions_list_post", "security": [ { @@ -766,7 +766,7 @@ "post": { "tags": ["sessions"], "summary": "Create Session", - "description": "Create a Session for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session (schemas.SessionCreate): The Session object containing any\n metadata\n\nReturns:\n schemas.Session: The Session object of the new Session", + "description": "Create a Session for a User", "operationId": "create_session_v1_apps__app_id__users__user_id__sessions_post", "security": [ { @@ -832,7 +832,7 @@ "put": { "tags": ["sessions"], "summary": "Update Session", - "description": "Update the metadata of a Session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to update\n session (schemas.SessionUpdate): The Session object containing any new metadata\n\nReturns:\n schemas.Session: The Session object of the updated Session", + "description": "Update the metadata of a Session", "operationId": "update_session_v1_apps__app_id__users__user_id__sessions__session_id__put", "security": [ { @@ -905,7 +905,7 @@ "delete": { "tags": ["sessions"], "summary": "Delete Session", - "description": "Delete a session by marking it as inactive\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to delete\n\nReturns:\n dict: A message indicating that the session was deleted\n\nRaises:\n HTTPException: If the session is not found", + "description": "Delete a session by marking it as inactive", "operationId": "delete_session_v1_apps__app_id__users__user_id__sessions__session_id__delete", "security": [ { @@ -966,7 +966,7 @@ "get": { "tags": ["sessions"], "summary": "Get Session", - "description": "Get a specific session for a user by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", + "description": "Get a specific session for a user by ID", "operationId": "get_session_v1_apps__app_id__users__user_id__sessions__session_id__get", "security": [ { @@ -1031,6 +1031,7 @@ "post": { "tags": ["sessions"], "summary": "Chat", + "description": "Chat with the Dialectic API", "operationId": "chat_v1_apps__app_id__users__user_id__sessions__session_id__chat_post", "security": [ { @@ -1105,6 +1106,7 @@ "post": { "tags": ["sessions"], "summary": "Get Chat Stream", + "description": "Stream Results from the Dialectic API", "operationId": "get_chat_stream_v1_apps__app_id__users__user_id__sessions__session_id__chat_stream_post", "security": [ { @@ -1183,6 +1185,7 @@ "get": { "tags": ["sessions"], "summary": "Clone Session", + "description": "Clone a session for a user, optionally will deep clone metamessages as well", "operationId": "clone_session_v1_apps__app_id__users__user_id__sessions__session_id__clone_get", "security": [ { @@ -1273,7 +1276,7 @@ "post": { "tags": ["messages"], "summary": "Create Message For Session", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n message (schemas.MessageCreate): The Message object to add containing the message content and type\n\nReturns:\n schemas.Message: The Message object of the added message\n\nRaises:\n HTTPException: If the session is not found", + "description": "Adds a message to a session", "operationId": "create_message_for_session_v1_apps__app_id__users__user_id__sessions__session_id__messages_post", "security": [ { @@ -1348,7 +1351,7 @@ "post": { "tags": ["messages"], "summary": "Get Messages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the messages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", + "description": "Get all messages for a session", "operationId": "get_messages_v1_apps__app_id__users__user_id__sessions__session_id__messages_list_post", "security": [ { @@ -1467,6 +1470,7 @@ "get": { "tags": ["messages"], "summary": "Get Message", + "description": "Get a Message by ID", "operationId": "get_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__get", "security": [ { @@ -1538,7 +1542,7 @@ "put": { "tags": ["messages"], "summary": "Update Message", - "description": "Update's the metadata of a message", + "description": "Update the metadata of a Message", "operationId": "update_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__put", "security": [ { @@ -1622,7 +1626,7 @@ "post": { "tags": ["metamessages"], "summary": "Create Metamessage", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n metamessage (schemas.MeteamessageCreate): The metamessage creation object\n\nReturns:\n schemas.Metamessage: The Metamessage object of the added metamessage\n\nRaises:\n HTTPException: If the session is not found", + "description": "Adds a message to a session", "operationId": "create_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_post", "security": [ { @@ -1697,7 +1701,7 @@ "post": { "tags": ["metamessages"], "summary": "Get Metamessages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", + "description": "Get all messages for a session", "operationId": "get_metamessages_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_list_post", "security": [ { @@ -1816,7 +1820,7 @@ "get": { "tags": ["metamessages"], "summary": "Get Metamessage", - "description": "Get a specific Metamessage by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", + "description": "Get a specific Metamessage by ID", "operationId": "get_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__get", "security": [ { @@ -1981,7 +1985,7 @@ "post": { "tags": ["metamessages"], "summary": "Get Metamessages By User", - "description": "Paginate through the user metamessages for a user\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", + "description": "Paginate through the user metamessages for a user", "operationId": "get_metamessages_by_user_v1_apps__app_id__users__user_id__metamessages_list_post", "security": [ { @@ -2091,7 +2095,7 @@ "post": { "tags": ["collections"], "summary": "Get Collections", - "description": "Get All Collections for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Collection]: List of Collection objects", + "description": "Get All Collections for a User", "operationId": "get_collections_v1_apps__app_id__users__user_id__collections_list_post", "security": [ { @@ -2201,6 +2205,7 @@ "get": { "tags": ["collections"], "summary": "Get Collection By Name", + "description": "Get a Collection by Name", "operationId": "get_collection_by_name_v1_apps__app_id__users__user_id__collections_name__name__get", "security": [ { @@ -2265,6 +2270,7 @@ "get": { "tags": ["collections"], "summary": "Get Collection By Id", + "description": "Get a Collection by ID", "operationId": "get_collection_by_id_v1_apps__app_id__users__user_id__collections__collection_id__get", "security": [ { @@ -2327,6 +2333,7 @@ "put": { "tags": ["collections"], "summary": "Update Collection", + "description": "Update a Collection's name or metadata", "operationId": "update_collection_v1_apps__app_id__users__user_id__collections__collection_id__put", "security": [ { @@ -2399,6 +2406,7 @@ "delete": { "tags": ["collections"], "summary": "Delete Collection", + "description": "Delete a Collection and its documents", "operationId": "delete_collection_v1_apps__app_id__users__user_id__collections__collection_id__delete", "security": [ { @@ -2461,6 +2469,7 @@ "post": { "tags": ["collections"], "summary": "Create Collection", + "description": "Create a new Collection", "operationId": "create_collection_v1_apps__app_id__users__user_id__collections_post", "security": [ { @@ -2526,6 +2535,7 @@ "post": { "tags": ["documents"], "summary": "Get Documents", + "description": "Get all of the Documents in a Collection", "operationId": "get_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_list_post", "security": [ { @@ -2644,6 +2654,7 @@ "get": { "tags": ["documents"], "summary": "Get Document", + "description": "Get a document by ID", "operationId": "get_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__get", "security": [ { @@ -2715,6 +2726,7 @@ "put": { "tags": ["documents"], "summary": "Update Document", + "description": "Update the content and/or the metadata of a Document", "operationId": "update_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__put", "security": [ { @@ -2796,6 +2808,7 @@ "delete": { "tags": ["documents"], "summary": "Delete Document", + "description": "Delete a Document by ID", "operationId": "delete_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__delete", "security": [ { @@ -2864,10 +2877,11 @@ } }, "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query": { - "get": { + "post": { "tags": ["documents"], "summary": "Query Documents", - "operationId": "query_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_query_get", + "description": "Cosine Similarity Search for Documents", + "operationId": "query_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_query_post", "security": [ { "HTTPBearer": [] @@ -2901,43 +2915,18 @@ "type": "string", "title": "Collection Id" } - }, - { - "name": "query", - "in": "query", - "required": true, - "schema": { - "type": "string", - "title": "Query" - } - }, - { - "name": "top_k", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 5, - "title": "Top K" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DocumentQuery" + } + } + } + }, "responses": { "200": { "description": "Successful Response", @@ -2948,7 +2937,7 @@ "items": { "$ref": "#/components/schemas/Document" }, - "title": "Response Query Documents V1 Apps App Id Users User Id Collections Collection Id Documents Query Get" + "title": "Response Query Documents V1 Apps App Id Users User Id Collections Collection Id Documents Query Post" } } } @@ -2970,6 +2959,7 @@ "post": { "tags": ["documents"], "summary": "Create Document", + "description": "Embed text as a vector and create a Document", "operationId": "create_document_v1_apps__app_id__users__user_id__collections__collection_id__documents_post", "security": [ { @@ -3326,6 +3316,34 @@ "type": "object", "title": "DocumentGet" }, + "DocumentQuery": { + "properties": { + "query": { + "type": "string", + "title": "Query" + }, + "filter": { + "anyOf": [ + { + "type": "object", + "additionalProperties": true + }, + { + "type": "null" + } + ], + "title": "Filter" + }, + "top_k": { + "type": "integer", + "title": "Top K", + "default": 5 + } + }, + "type": "object", + "required": ["query"], + "title": "DocumentQuery" + }, "DocumentUpdate": { "properties": { "metadata": { diff --git a/openapi.stainless.yml b/openapi.stainless.yml index 9f24b5b..4ef25b2 100644 --- a/openapi.stainless.yml +++ b/openapi.stainless.yml @@ -94,7 +94,7 @@ resources: delete: >- delete /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id} - query: get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query + query: post /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query models: document: Document page_document: Page_Document_ diff --git a/transform.py b/transform.py index 9efe424..7199c2f 100644 --- a/transform.py +++ b/transform.py @@ -99,8 +99,18 @@ def transform_openapi(input_file, output_file): json.dump(data, f, indent=2) +def normalize_json(input_file, output_file): + with open(input_file, "r") as f: + data = json.load(f) + + with open(output_file, "w") as f: + json.dump(data, f, indent=2) + + # Usage +normalize_json("openapi.json", "openapi.json") input_file = "openapi-new.json" output_file = "output.json" transform_openapi(input_file, output_file) +normalize_json(output_file, output_file) print(f"Transformation complete. Output written to {output_file}")