From e68aceaab2714e3d3e441f521ed788d9defca9fe Mon Sep 17 00:00:00 2001 From: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:12:31 -0500 Subject: [PATCH] Single prompt tom (#89) * Add TOM method switching * Add system prompt and note on format * Add persistence tweaks * Specify format for each section of user representation * Parse XML tags before saving representation metamessage * Clean up * Use Claude 3.5 Haiku and refine prompt * Simplify message processing * chore: update token limit on dialectic and model for deriver * chore: Update to Contributing Docs and .env template * Contributing Docs * chore: Add Deriver Template Variables * chore: Remove healthcheck endpoint * chore: Changelog updates --------- Co-authored-by: Daniel Balcells --- .env.template | 10 +- .vscode/tasks.json | 2 +- CHANGELOG.md | 13 + CONTRIBUTING.md | 47 +- docs/README.md | 17 +- docs/contributing/self-hosting.mdx | 26 +- docs/formatted_old.json | 4426 ----------------- docs/getting-started/introduction.mdx | 13 +- src/agent.py | 2 +- src/deriver/consumer.py | 246 +- src/deriver/tom/__init__.py | 30 + src/deriver/{voe.py => tom/conversational.py} | 4 +- src/deriver/tom/single_prompt.py | 187 + 13 files changed, 398 insertions(+), 4625 deletions(-) delete mode 100644 docs/formatted_old.json create mode 100644 src/deriver/tom/__init__.py rename src/deriver/{voe.py => tom/conversational.py} (99%) create mode 100644 src/deriver/tom/single_prompt.py diff --git a/.env.template b/.env.template index a1d661cc..c31cca36 100644 --- a/.env.template +++ b/.env.template @@ -2,20 +2,22 @@ CONNECTION_URI=postgresql+psycopg://testuser:testpwd@localhost:5432/honcho # sam # CONNECTION_URI=postgresql+psycopg://testuser:testpwd@database:5432/honcho # sample for docker-compose database -OPENAI_API_KEY= +OPENAI_API_KEY= # Used for vector embeddings +ANTHROPIC_API_KEY= # Used for the deriver and dialectic API # Logging SENTRY_ENABLED=false # Set to true to enable Sentry logging and tracing -LOGFIRE_TOKEN= # optional logfire config # Auth - USE_AUTH_SERVICE=false -AUTH_SERVICE_URL=http://localhost:8001 +SECRET_KEY= # Sentry SENTRY_DSN= # Deriver DERIVER_WORKERS=1 +TOM_METHOD="single_prompt" +USER_REPRESENTATION_METHOD="single_prompt" + diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8e9b1da5..aa34a8e5 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,7 @@ { "label": "start", "type": "shell", - "command": "poetry install --no-root && poetry run uvicorn src.main:app --reload", + "command": "uv sync && uv run fastapi dev src/main.py", "group": "none", "presentation": { "reveal": "always", diff --git a/CHANGELOG.md b/CHANGELOG.md index 45df5664..61baf82c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.0.16] + +## Changed + +- Deriver to use a new cognitive architecture that only updates on user messages + and updates user representation to apply more confidence scores to its known + facts +- Dialectic API token cutoff from 150 tokens to 300 + +## Fixed + +- Self-hosting documentation and README to mention `uv` instead of `poetry` + ## [0.0.15] ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67bd5ec1..ca8e2676 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ This project is completely open source and welcomes any and all open source contributions. The workflow for contributing is to make a fork of the repository. You can claim an issue in the issues tab or start a new thread to -indicate a feature or bug fix you are working on. +indicate a feature or bug fix you are working on. Once you have finished your contribution make a PR , and it will be reviewed by a project manager. Feel free to join us in our @@ -22,15 +22,15 @@ Server. ### Prerequisites and Dependencies -Honcho is developed using [python](https://www.python.org/) and [poetry](https://python-poetry.org/). +Honcho is developed using [python](https://www.python.org/) and [uv](https://docs.astral.sh/uv/). The minimum python version is `3.9` -The minimum poetry version is `1.4.1` +The minimum poetry version is `0.4.9` ### Setup Once the dependencies are installed on the system run the following steps to get -the local project setup. +the local project setup. 1. Clone the repository @@ -41,28 +41,34 @@ git clone https://github.com/plastic-labs/honcho.git 2. Enter the repository and install the python dependencies We recommend using a virtual environment to isolate the dependencies for Honcho -from other projects on the same system. With `poetry` a virtual environment can -be generated using the `poetry shell` command. Once the virtual environment is -created and activated install the dependencies with `poetry install` +from other projects on the same system. `uv` will create a virtual environment +when you sync your dependencies in the project. Putting this together: ```bash cd honcho -poetry shell -poetry install +uv sync +``` + +This will create a virtual environment and install the dependencies for Honcho. +The default virtual environment will be located at `honcho/.venv`. Activate the +virtual environment via: + +```bash +source honcho/.venv/bin/activate ``` 3. Set up a database -Honcho utilized [Postgres](https://www.postgresql.org/) for its database with +Honcho utilized [Postgres](https://www.postgresql.org/) for its database with pgvector. An easy way to get started with a postgresdb is to create a project with [Supabase](https://supabase.com/) A `docker-compose` template is also available with a database configuration -available. +available. -4. Edit the environment variables. +4. Edit the environment variables. Honcho uses a `.env` file for managing runtime environment variables. A `.env.template` file is included for convenience. Several of the configurations @@ -73,18 +79,19 @@ Below are the required configurations ```env CONNECTION_URI= # Connection uri for a postgres database -OPENAI_API_KEY= # API Key for OpenAI used for insights +OPENAI_API_KEY= # API Key for OpenAI used for embedding documents +ANTHROPIC_API_KEY= # API Key for Anthropic used for the deriver and dialectic API ``` + > Note that the `CONNECTION_URI` must have the prefix `postgresql+psycopg` to > function properly. This is a requirement brought by `sqlalchemy` The template has the additional functionality disabled by default. To ensure that they are disabled you can verify the following environment variables are -set to false. +set to false. ```env USE_AUTH_SERVICE=false -OPENTELEMETRY_ENABLED=false SENTRY_ENABLED=false ``` @@ -95,8 +102,9 @@ and the environment variables setup you can now launch a local instance of Honcho. The following command will launch the storage API for Honcho ```bash -python -m uvicorn src.main:app --reload --port 8000 +fastapi dev src/main.py ``` + This is a development server that will reload whenever code is changed. When first launching the API with a connection the database it will provision the necessary tables for Honcho to operate. @@ -105,10 +113,10 @@ necessary tables for Honcho to operate. As mentioned earlier a `docker-compose` template is included for running Honcho. As an alternative to running Honcho locally it can also be run with the compose -template. +template. The docker-compose template is set to use an environment file called `.env`. -You can also copy the `.env.template` and fill with the appropriate values. +You can also copy the `.env.template` and fill with the appropriate values. Copy the template and update the appropriate environment variables before launching the service. @@ -116,7 +124,7 @@ launching the service. ```bash cd honcho/api cp .env.template .env -# update the file with openai key and other wanted environment variables +# update the file with openai key and other wanted environment variables cp docker-compose.yml.example docker-compose.yml docker compose up ``` @@ -140,4 +148,3 @@ flyctl launch --no-deploy # Follow the prompts and edit as you see fit cat .env | flyctl secrets import # Load in your secrets flyctl deploy # Deploy with appropriate environment variables ``` - diff --git a/docs/README.md b/docs/README.md index c0116503..70609f46 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,21 +1,20 @@ -# honcho-docs +# Honcho Docs -## Setting Up `honcho-docs` Locally +These docs are built using Next.js via mintlify. + +## Setting Up Honcho's Docs Locally 1. Clone the repository: ``` -git clone git@github.com:plastic-labs/honcho-docs.git +git clone git@github.com:plastic-labs/honcho.git ``` -2. Navigate into the `honcho-docs` folder: +2. Navigate into the `docs` folder: ``` -cd honcho-docs/ +cd honcho/docs/ ``` The docs folder contains the markdown files that make up the documentation. The majority of the files are in the pages directory. Some notable files in this folder include: -`index.mdx`: The main documentation file. -`_app.js`: This file is used to customize the default Next.js application shell. -`theme.config.jsx`: This file is for configuring the Nextra theme for the documentation. 3. Verify that you have Node.js and npm installed in your system. You can check by running: ``` @@ -30,7 +29,7 @@ npm --version npm install -g pnpm ``` -6. Install the project dependencies using yarn: +6. Install the project dependencies using pnpm: ``` pnpm i ``` diff --git a/docs/contributing/self-hosting.mdx b/docs/contributing/self-hosting.mdx index 4267cf78..0f752b56 100644 --- a/docs/contributing/self-hosting.mdx +++ b/docs/contributing/self-hosting.mdx @@ -10,10 +10,10 @@ icon: 'cloud' ### Prerequisites and Dependencies -Honcho is developed using [python](https://www.python.org/) and [poetry](https://python-poetry.org/). +Honcho is developed using [python](https://www.python.org/) and [uv](https://docs.astral.sh/uv/). The minimum python version is `3.9` -The minimum poetry version is `1.4.1` +The minimum poetry version is `0.4.9` ### Setup @@ -29,16 +29,22 @@ git clone https://github.com/plastic-labs/honcho.git 2. Enter the repository and install the python dependencies We recommend using a virtual environment to isolate the dependencies for Honcho -from other projects on the same system. With `poetry` a virtual environment can -be generated using the `poetry shell` command. Once the virtual environment is -created and activated install the dependencies with `poetry install` +from other projects on the same system. `uv` will create a virtual environment +when you sync your dependencies in the project. Putting this together: ```bash cd honcho -poetry shell -poetry install +uv sync +``` + +This will create a virtual environment and install the dependencies for Honcho. +The default virtual environment will be located at `honcho/.venv`. Activate the +virtual environment via: + +```bash +source honcho/.venv/bin/activate ``` 3. Set up a database @@ -61,7 +67,8 @@ Below are the required configurations ```env CONNECTION_URI= # Connection uri for a postgres database -OPENAI_API_KEY= # API Key for OpenAI used for insights +OPENAI_API_KEY= # API Key for OpenAI used for embedding documents +ANTHROPIC_API_KEY= # API Key for Anthropic used for the deriver and dialectic API ``` > Note that the `CONNECTION_URI` must have the prefix `postgresql+psycopg` to > function properly. This is a requirement brought by `sqlalchemy` @@ -72,7 +79,6 @@ set to false. ```env USE_AUTH_SERVICE=false -OPENTELEMETRY_ENABLED=false SENTRY_ENABLED=false ``` @@ -83,7 +89,7 @@ and the environment variables setup you can now launch a local instance of Honcho. The following command will launch the storage API for Honcho ```bash -python -m uvicorn src.main:app --reload --port 8000 +fastapi dev src/main.py ``` This is a development server that will reload whenever code is changed. When first launching the API with a connection the database it will provision the diff --git a/docs/formatted_old.json b/docs/formatted_old.json deleted file mode 100644 index f75bd032..00000000 --- a/docs/formatted_old.json +++ /dev/null @@ -1,4426 +0,0 @@ -{ - "openapi": "3.1.0", - "info": { - "title": "Honcho API", - "summary": "An API for adding personalization to AI Apps", - "description": "This API is used to store data and get insights about users for AI\n applications", - "version": "0.0.11" - }, - "servers": [ - { - "url": "http://127.0.0.1:8000", - "description": "Local Development Server" - }, - { - "url": "https:/demo.honcho.dev", - "description": "Demo Server" - } - ], - "paths": { - "/apps/{app_id}": { - "get": { - "tags": [ - "apps" - ], - "summary": "Get App", - "description": "Get an App by ID\n\nArgs:\n app_id (uuid.UUID): The ID of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_app_apps__app_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get(\n \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(app.id)" - } - ] - }, - "put": { - "tags": [ - "apps" - ], - "summary": "Update App", - "description": "Update an App\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "update_app_apps__app_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.update(\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(app.id)" - } - ] - } - }, - "/apps/name/{name}": { - "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", - "operationId": "get_app_by_name_apps_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getByName('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_by_name(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/apps": { - "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", - "operationId": "create_app_apps_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppCreate" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.create({ name: 'name' });\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.create(\n name=\"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/apps/get_or_create/{name}": { - "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", - "operationId": "get_or_create_app_apps_get_or_create__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getOrCreate('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_or_create(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/apps/{app_id}/users": { - "post": { - "tags": [ - "users" - ], - "summary": "Create User", - "description": "Create a User\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "create_user_apps__app_id__users_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { name: 'name' });\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.create(\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n name=\"name\",\n)\nprint(user.id)" - } - ] - }, - "get": { - "tags": [ - "users" - ], - "summary": "Get Users", - "description": "Get All Users for an App\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client\n application using honcho\n\nReturns:\n list[schemas.User]: List of User objects", - "operationId": "get_users_apps__app_id__users_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_User_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const user of client.apps.users.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e')) {\n console.log(user.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.list(\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/apps/{app_id}/users/name/{name}": { - "get": { - "tags": [ - "users" - ], - "summary": "Get User By Name", - "description": "Get a User\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_user_by_name_apps__app_id__users_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getByName('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_by_name(\n name=\"name\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(user.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}": { - "get": { - "tags": [ - "users" - ], - "summary": "Get User", - "description": "Get a User\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_user_apps__app_id__users__user_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(user.id)" - } - ] - }, - "put": { - "tags": [ - "users" - ], - "summary": "Update User", - "description": "Update a User\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "update_user_apps__app_id__users__user_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.update(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(user.id)" - } - ] - } - }, - "/apps/{app_id}/users/get_or_create/{name}": { - "get": { - "tags": [ - "users" - ], - "summary": "Get Or Create User", - "description": "Get or Create a User\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_or_create_user_apps__app_id__users_get_or_create__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getOrCreate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_or_create(\n name=\"name\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(user.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions": { - "get": { - "tags": [ - "sessions" - ], - "summary": "Get Sessions", - "description": "Get All Sessions for a User\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client application using\n honcho\n user_id (uuid.UUID): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Session]: List of Session objects", - "operationId": "get_sessions_apps__app_id__users__user_id__sessions_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "is_active", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Is Active" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Session_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const session of client.apps.users.sessions.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n )) {\n console.log(session.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.list(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - }, - "post": { - "tags": [ - "sessions" - ], - "summary": "Create Session", - "description": "Create a Session for a User\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client\n application using honcho\n user_id (uuid.UUID): 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", - "operationId": "create_session_apps__app_id__users__user_id__sessions_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.create(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(session.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}": { - "put": { - "tags": [ - "sessions" - ], - "summary": "Update Session", - "description": "Update the metadata of a Session\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client application using\n honcho\n user_id (uuid.UUID): The User ID representing the user, managed by the user\n session_id (uuid.UUID): 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", - "operationId": "update_session_apps__app_id__users__user_id__sessions__session_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.update(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(session.id)" - } - ] - }, - "delete": { - "tags": [ - "sessions" - ], - "summary": "Delete Session", - "description": "Delete a session by marking it as inactive\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client application using\n honcho\n user_id (uuid.UUID): The User ID representing the user, managed by the user\n session_id (uuid.UUID): 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", - "operationId": "delete_session_apps__app_id__users__user_id__sessions__session_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const sessionDeleteResponse = await client.apps.users.sessions.delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(sessionDeleteResponse);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession_delete_response = client.apps.users.sessions.delete(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(session_delete_response)" - } - ] - }, - "get": { - "tags": [ - "sessions" - ], - "summary": "Get Session", - "description": "Get a specific session for a user by ID\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client application using\n honcho\n user_id (uuid.UUID): The User ID representing the user, managed by the user\n session_id (uuid.UUID): 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", - "operationId": "get_session_apps__app_id__users__user_id__sessions__session_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.get(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(session.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat": { - "get": { - "tags": [ - "sessions" - ], - "summary": "Get Chat", - "operationId": "get_chat_apps__app_id__users__user_id__sessions__session_id__chat_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "query", - "in": "query", - "required": true, - "schema": { - "type": "string", - "title": "Query" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AgentChat" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const agentChat = await client.apps.users.sessions.chat(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { query: 'query' },\n );\n\n console.log(agentChat.content);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nagent_chat = client.apps.users.sessions.chat(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n query=\"query\",\n)\nprint(agent_chat.content)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream": { - "get": { - "tags": [ - "sessions" - ], - "summary": "Get Chat Stream", - "operationId": "get_chat_stream_apps__app_id__users__user_id__sessions__session_id__chat_stream_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "query", - "in": "query", - "required": true, - "schema": { - "type": "string", - "title": "Query" - } - } - ], - "responses": { - "200": { - "description": "Chat stream", - "content": { - "application/json": { - "schema": {} - }, - "text/event-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const sessionStreamResponse = await client.apps.users.sessions.stream(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { query: 'query' },\n );\n\n console.log(sessionStreamResponse);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession_stream_response = client.apps.users.sessions.stream(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n query=\"query\",\n)\nprint(session_stream_response)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages": { - "post": { - "tags": [ - "messages" - ], - "summary": "Create Message For Session", - "description": "Adds a message to a session\n\nArgs:\n app_id (uuid.UUID): 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 message (schemas.MessageCreate): The Message object to add containing the\n 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", - "operationId": "create_message_for_session_apps__app_id__users__user_id__sessions__session_id__messages_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { content: 'content', is_user: true },\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.create(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n content=\"content\",\n is_user=True,\n)\nprint(message.id)" - } - ] - }, - "get": { - "tags": [ - "messages" - ], - "summary": "Get Messages", - "description": "Get all messages for a session\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_messages_apps__app_id__users__user_id__sessions__session_id__messages_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Message_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const message of client.apps.users.sessions.messages.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n )) {\n console.log(message.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.messages.list(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}": { - "get": { - "tags": [ - "messages" - ], - "summary": "Get Message", - "operationId": "get_message_apps__app_id__users__user_id__sessions__session_id__messages__message_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Message Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.get(\n message_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(message.id)" - } - ] - }, - "put": { - "tags": [ - "messages" - ], - "summary": "Update Message", - "description": "Update's the metadata of a message", - "operationId": "update_message_apps__app_id__users__user_id__sessions__session_id__messages__message_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Message Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.update(\n message_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(message.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages": { - "post": { - "tags": [ - "messages" - ], - "summary": "Create Metamessage", - "description": "Adds a metamessage to a session\n\nArgs:\n app_id (uuid.UUID): 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 metamessage to\n metamessage (schemas.MetamessageCreate): The Metamessage object to add containing the\n metamessage content and type\n\nReturns:\n schemas.Metamessage: The Metamessage object of the added metamessage\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "create_metamessage_apps__app_id__users__user_id__sessions__session_id__metamessages_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n {\n content: 'content',\n message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n metamessage_type: 'metamessage_type',\n },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.create(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n content=\"content\",\n message_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n metamessage_type=\"metamessage_type\",\n)\nprint(metamessage.id)" - } - ] - }, - "get": { - "tags": [ - "messages" - ], - "summary": "Get Metamessages", - "description": "Get all messages for a session\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_metamessages_apps__app_id__users__user_id__sessions__session_id__metamessages_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "message_id", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string", - "format": "uuid" - }, - { - "type": "null" - } - ], - "title": "Message Id" - } - }, - { - "name": "metamessage_type", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Metamessage Type" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Metamessage_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const metamessage of client.apps.users.sessions.metamessages.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n )) {\n console.log(metamessage.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.metamessages.list(\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}": { - "get": { - "tags": [ - "messages" - ], - "summary": "Get Metamessage", - "description": "Get a specific Metamessage by ID\n\nArgs:\n app_id (uuid.UUID): 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", - "operationId": "get_metamessage_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Metamessage Id" - } - }, - { - "name": "message_id", - "in": "query", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Message Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.get(\n metamessage_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n message_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(metamessage.id)" - } - ] - }, - "put": { - "tags": [ - "messages" - ], - "summary": "Update Metamessage", - "description": "Update's the metadata of a metamessage", - "operationId": "update_metamessage_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Session Id" - } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Metamessage Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.update(\n metamessage_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n session_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n message_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(metamessage.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections": { - "get": { - "tags": [ - "collections" - ], - "summary": "Get Collections", - "description": "Get All Collections for a User\n\nArgs:\n app_id (uuid.UUID): The ID of the app representing the client\n application using honcho\n user_id (uuid.UUID): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Collection]: List of Collection objects", - "operationId": "get_collections_apps__app_id__users__user_id__collections_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Collection_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const collection of client.apps.users.collections.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n )) {\n console.log(collection.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.list(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - }, - "post": { - "tags": [ - "collections" - ], - "summary": "Create Collection", - "operationId": "create_collection_apps__app_id__users__user_id__collections_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CollectionCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { name: 'name' },\n );\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.create(\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n name=\"name\",\n)\nprint(collection.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections/name/{name}": { - "get": { - "tags": [ - "collections" - ], - "summary": "Get Collection By Name", - "operationId": "get_collection_by_name_apps__app_id__users__user_id__collections_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.getByName(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'name',\n );\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get_by_name(\n name=\"name\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(collection.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections/{collection_id}": { - "get": { - "tags": [ - "collections" - ], - "summary": "Get Collection By Id", - "operationId": "get_collection_by_id_apps__app_id__users__user_id__collections__collection_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(collection.id)" - } - ] - }, - "put": { - "tags": [ - "collections" - ], - "summary": "Update Collection", - "operationId": "update_collection_apps__app_id__users__user_id__collections__collection_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CollectionUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.update(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(collection.id)" - } - ] - }, - "delete": { - "tags": [ - "collections" - ], - "summary": "Delete Collection", - "operationId": "delete_collection_apps__app_id__users__user_id__collections__collection_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collectionDeleteResponse = await client.apps.users.collections.delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(collectionDeleteResponse);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection_delete_response = client.apps.users.collections.delete(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(collection_delete_response)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents": { - "get": { - "tags": [ - "documents" - ], - "summary": "Get Documents", - "operationId": "get_documents_apps__app_id__users__user_id__collections__collection_id__documents_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Document_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const document of client.apps.users.collections.documents.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n )) {\n console.log(document.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.documents.list(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - }, - "post": { - "tags": [ - "documents" - ], - "summary": "Create Document", - "operationId": "create_document_apps__app_id__users__user_id__collections__collection_id__documents_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DocumentCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.create(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { content: 'content' },\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.create(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n content=\"content\",\n)\nprint(document.id)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}": { - "get": { - "tags": [ - "documents" - ], - "summary": "Get Document", - "operationId": "get_document_apps__app_id__users__user_id__collections__collection_id__documents__document_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Document Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.get(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.get(\n document_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(document.id)" - } - ] - }, - "put": { - "tags": [ - "documents" - ], - "summary": "Update Document", - "operationId": "update_document_apps__app_id__users__user_id__collections__collection_id__documents__document_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Document Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DocumentUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.update(\n document_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(document.id)" - } - ] - }, - "delete": { - "tags": [ - "documents" - ], - "summary": "Delete Document", - "operationId": "delete_document_apps__app_id__users__user_id__collections__collection_id__documents__document_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Document Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const documentDeleteResponse = await client.apps.users.collections.documents.delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(documentDeleteResponse);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument_delete_response = client.apps.users.collections.documents.delete(\n document_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n)\nprint(document_delete_response)" - } - ] - } - }, - "/apps/{app_id}/users/{user_id}/collections/{collection_id}/query": { - "get": { - "tags": [ - "documents" - ], - "summary": "Query Documents", - "operationId": "query_documents_apps__app_id__users__user_id__collections__collection_id__query_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "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" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Document" - }, - "title": "Response Query Documents Apps App Id Users User Id Collections Collection Id Documents Query Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collectionQueryResponse = await client.apps.users.collections.query(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { query: 'query' },\n );\n\n console.log(collectionQueryResponse);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection_query_response = client.apps.users.collections.query(\n collection_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n app_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n user_id=\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n query=\"query\",\n)\nprint(collection_query_response)" - } - ] - } - } - }, - "components": { - "schemas": { - "AgentChat": { - "properties": { - "content": { - "type": "string", - "title": "Content" - } - }, - "type": "object", - "required": [ - "content" - ], - "title": "AgentChat" - }, - "App": { - "properties": { - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "name", - "metadata", - "created_at" - ], - "title": "App", - "exclude": [ - "h_metadata" - ] - }, - "AppCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "name" - ], - "title": "AppCreate" - }, - "AppUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "AppUpdate" - }, - "Collection": { - "properties": { - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "user_id": { - "type": "string", - "format": "uuid", - "title": "User Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "name", - "user_id", - "metadata", - "created_at" - ], - "title": "Collection", - "exclude": [ - "h_metadata" - ] - }, - "CollectionCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "name" - ], - "title": "CollectionCreate" - }, - "CollectionUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "CollectionUpdate" - }, - "Document": { - "properties": { - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "content": { - "type": "string", - "title": "Content" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "collection_id": { - "type": "string", - "format": "uuid", - "title": "Collection Id" - } - }, - "type": "object", - "required": [ - "id", - "content", - "metadata", - "created_at", - "collection_id" - ], - "title": "Document", - "exclude": [ - "h_metadata" - ] - }, - "DocumentCreate": { - "properties": { - "content": { - "type": "string", - "title": "Content" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "content" - ], - "title": "DocumentCreate" - }, - "DocumentUpdate": { - "properties": { - "content": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Content" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "DocumentUpdate" - }, - "HTTPValidationError": { - "properties": { - "detail": { - "items": { - "$ref": "#/components/schemas/ValidationError" - }, - "type": "array", - "title": "Detail" - } - }, - "type": "object", - "title": "HTTPValidationError" - }, - "Message": { - "properties": { - "content": { - "type": "string", - "title": "Content" - }, - "is_user": { - "type": "boolean", - "title": "Is User" - }, - "session_id": { - "type": "string", - "format": "uuid", - "title": "Session Id" - }, - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "content", - "is_user", - "session_id", - "id", - "metadata", - "created_at" - ], - "title": "Message", - "exclude": [ - "h_metadata" - ] - }, - "MessageCreate": { - "properties": { - "content": { - "type": "string", - "title": "Content" - }, - "is_user": { - "type": "boolean", - "title": "Is User" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "content", - "is_user" - ], - "title": "MessageCreate" - }, - "MessageUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "MessageUpdate" - }, - "Metamessage": { - "properties": { - "metamessage_type": { - "type": "string", - "title": "Metamessage Type" - }, - "content": { - "type": "string", - "title": "Content" - }, - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "message_id": { - "type": "string", - "format": "uuid", - "title": "Message Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "metamessage_type", - "content", - "id", - "message_id", - "metadata", - "created_at" - ], - "title": "Metamessage", - "exclude": [ - "h_metadata" - ] - }, - "MetamessageCreate": { - "properties": { - "metamessage_type": { - "type": "string", - "title": "Metamessage Type" - }, - "content": { - "type": "string", - "title": "Content" - }, - "message_id": { - "type": "string", - "format": "uuid", - "title": "Message Id" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "metamessage_type", - "content", - "message_id" - ], - "title": "MetamessageCreate" - }, - "MetamessageUpdate": { - "properties": { - "message_id": { - "type": "string", - "format": "uuid", - "title": "Message Id" - }, - "metamessage_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Metamessage Type" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "required": [ - "message_id" - ], - "title": "MetamessageUpdate" - }, - "Page_Collection_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Collection" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[Collection]" - }, - "Page_Document_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Document" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[Document]" - }, - "Page_Message_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Message" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[Message]" - }, - "Page_Metamessage_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Metamessage" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[Metamessage]" - }, - "Page_Session_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Session" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[Session]" - }, - "Page_User_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/User" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": [ - "items", - "total", - "page", - "size" - ], - "title": "Page[User]" - }, - "Session": { - "properties": { - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "is_active": { - "type": "boolean", - "title": "Is Active" - }, - "user_id": { - "type": "string", - "format": "uuid", - "title": "User Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "is_active", - "user_id", - "metadata", - "created_at" - ], - "title": "Session", - "exclude": [ - "h_metadata" - ] - }, - "SessionCreate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "location_id" - ], - "title": "SessionCreate" - }, - "SessionUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "SessionUpdate" - }, - "User": { - "properties": { - "id": { - "type": "string", - "format": "uuid", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "app_id": { - "type": "string", - "format": "uuid", - "title": "App Id" - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - } - }, - "type": "object", - "required": [ - "id", - "name", - "app_id", - "created_at", - "metadata" - ], - "title": "User", - "exclude": [ - "h_metadata" - ] - }, - "UserCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": [ - "name" - ], - "title": "UserCreate" - }, - "UserUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "UserUpdate" - }, - "ValidationError": { - "properties": { - "loc": { - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - }, - "type": "array", - "title": "Location" - }, - "msg": { - "type": "string", - "title": "Message" - }, - "type": { - "type": "string", - "title": "Error Type" - } - }, - "type": "object", - "required": [ - "loc", - "msg", - "type" - ], - "title": "ValidationError" - } - }, - "securitySchemes": { - "HTTPBearer": { - "type": "http", - "scheme": "bearer" - } - } - } -} diff --git a/docs/getting-started/introduction.mdx b/docs/getting-started/introduction.mdx index ea3ce59b..0da4356a 100644 --- a/docs/getting-started/introduction.mdx +++ b/docs/getting-started/introduction.mdx @@ -1,18 +1,19 @@ --- title: 🫡 Welcome to Honcho sidebarTitle: 'Overview' -description: 'Honcho is an open source platform for building personalized AI experiences.' +description: 'The identity layer for the agentic world' icon: 'face-saluting' --- -Honcho provides an simple API store data for AI applications in a user-centric -fashion and derive insights about users that improve the ability of -applications to quickly deliver value to the User. +Honcho is an infrastructure layer that empowers AI agents with social cognition and deeper understanding of their users. -Now you can focus on improving your service instead of spending -countless hours figuring out how to get it to scale and be personalized. +The API is built on two core concepts: *Storage* and *Insights*. The Storage API provides a flexible memory framework that can store both chat conversations and vector embeddings of user interactions. This forms the foundation for building more socially aware agents. + +The Insights layer analyzes these stored interactions to build rich user profiles, which can be queried through a natural language dialectic endpoint. This allows agents to develop a nuanced understanding of users' preferences, behaviors, and needs over time. + +By handling the complex infrastructure needed for memory and user understanding, Honcho lets you focus on building amazing AI experiences. No more worrying about how to scale personalization - we've got you covered. To learn more about the project, check out our [blog post](https://blog.plasticlabs.ai/blog/A-Simple-Honcho-Primer). diff --git a/src/agent.py b/src/agent.py index 6264c4c4..3cea132b 100644 --- a/src/agent.py +++ b/src/agent.py @@ -73,7 +73,7 @@ class Dialectic: system=self.system_prompt, messages=messages, model=self.model, - max_tokens=150, + max_tokens=300, ) return response.content diff --git a/src/deriver/consumer.py b/src/deriver/consumer.py index 57783230..9463b4f4 100644 --- a/src/deriver/consumer.py +++ b/src/deriver/consumer.py @@ -9,13 +9,16 @@ from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from .. import models -from .voe import tom_inference, user_representation +from .tom import get_tom_inference, get_user_representation # Turn off SQLAlchemy Echo logging logging.getLogger("sqlalchemy.engine.Engine").disabled = True console = Console(markup=False) +TOM_METHOD = os.getenv("TOM_METHOD", "single_prompt") +USER_REPRESENTATION_METHOD = os.getenv("USER_REPRESENTATION_METHOD", "single_prompt") + # FIXME see if this is SAFE async def add_metamessage(db, message_id, metamessage_type, content): @@ -34,6 +37,29 @@ def parse_xml_content(text, tag): return match.group(1).strip() if match else "" +async def get_chat_history(db, session_id, message_id) -> str: + subquery = ( + select(models.Message.id) + .where(models.Message.public_id == message_id) + .scalar_subquery() + ) + messages_stmt = ( + select(models.Message) + .where(models.Message.session_id == session_id) + .order_by(models.Message.id.desc()) + .where(models.Message.id < subquery) + .limit(10) + ) + + result = await db.execute(messages_stmt) + messages = result.scalars().all()[::-1] + + chat_history_str = "\n".join( + [f"human: {m.content}" if m.is_user else f"ai: {m.content}" for m in messages] + ) + return chat_history_str + + async def process_item(db: AsyncSession, payload: dict): processing_args = [ payload["content"], @@ -65,54 +91,6 @@ async def process_ai_message( """ console.print(f"Processing AI message: {content}", style="bright_magenta") - subquery = ( - select(models.Message.id) - .where(models.Message.public_id == message_id) - .scalar_subquery() - ) - messages_stmt = ( - select(models.Message) - .where(models.Message.session_id == session_id) - .order_by(models.Message.id.desc()) - .where(models.Message.id < subquery) - .limit(10) - ) - - result = await db.execute(messages_stmt) - messages = result.scalars().all()[::-1] - - chat_history_str = "\n".join( - [f"human: {m.content}" if m.is_user else f"ai: {m.content}" for m in messages] - ) - # append current message to chat history - chat_history_str = f"{chat_history_str}\nai: {content}" - - langfuse_context.update_current_trace( - session_id=session_id, - user_id=user_id, - release=os.getenv("SENTRY_RELEASE"), - metadata={"environment": os.getenv("SENTRY_ENVIRONMENT")}, - ) - - tom_inference_response = await tom_inference( - chat_history_str, session_id=session_id - ) - - prediction = parse_xml_content(tom_inference_response, "prediction") - - await add_metamessage( - db, - message_id, - "tom_inference", - prediction, - ) - - await db.commit() - - console.print("Tom Inference:", style="blue") - content_lines = str(prediction) - console.print(content_lines, style="blue") - @sentry_sdk.trace @observe() @@ -125,112 +103,88 @@ async def process_user_message( db: AsyncSession, ): """ - Process a user message. If there are revised user predictions to run VoE against, run it. Otherwise pass. + Process a user message by: + - Getting TOM inference + - Getting user representation """ console.print(f"Processing User Message: {content}", style="orange1") - subquery = ( - select(models.Message.id) - .where(models.Message.public_id == message_id) - .scalar_subquery() - ) - messages_stmt = ( - select(models.Message) - .where(models.Message.session_id == session_id) - .where(models.Message.is_user == False) - .order_by(models.Message.id.desc()) - .where(models.Message.id < subquery) + # Get chat history and append current message + chat_history_str = await get_chat_history(db, session_id, message_id) + chat_history_str = f"{chat_history_str}\nhuman: {content}" + + # Get TOM inference, parse and save it + tom_inference_response = await get_tom_inference( + chat_history_str, session_id, method=TOM_METHOD + ) + tom_inference = parse_xml_content(tom_inference_response, "prediction") + await add_metamessage( + db, + message_id, + "tom_inference", + tom_inference, + ) + await db.commit() + + # Fetch the latest user representation + user_representation_stmt = ( + select(models.Metamessage) + .join( + models.Message, + models.Message.public_id == models.Metamessage.message_id, + ) + .join( + models.Session, + models.Message.session_id == models.Session.public_id, + ) + .join(models.User, models.User.public_id == models.Session.user_id) + .join(models.App, models.App.public_id == models.User.app_id) + .where(models.App.public_id == app_id) + .where(models.User.public_id == user_id) + .where(models.Metamessage.metamessage_type == "user_representation") + .order_by(models.Metamessage.id.desc()) # get the most recent .limit(1) ) - response = await db.execute(messages_stmt) - ai_message = response.scalar_one_or_none() + response = await db.execute(user_representation_stmt) + existing_representation = response.scalar_one_or_none() - if ai_message and ai_message.content: - console.print(f"AI Message: {ai_message.content}", style="bright_magenta") + existing_representation_content = ( + existing_representation.content if existing_representation else "None" + ) + print(f"Existing Representation: {existing_representation_content}") - # Fetch the tom_inference metamessage - tom_inference_stmt = ( - select(models.Metamessage) - .where(models.Metamessage.message_id == ai_message.public_id) - .where(models.Metamessage.metamessage_type == "tom_inference") - .order_by( - models.Metamessage.id.asc() - ) # Get the earliest tom inference on this message - .limit(1) - ) - response = await db.execute(tom_inference_stmt) - tom_inference_metamessage = response.scalar_one_or_none() + langfuse_context.update_current_trace( + session_id=session_id, + user_id=user_id, + release=os.getenv("SENTRY_RELEASE"), + metadata={"environment": os.getenv("SENTRY_ENVIRONMENT")}, + ) - if tom_inference_metamessage and tom_inference_metamessage.content: - console.print( - f"Tom Inference: {tom_inference_metamessage.content}", style="blue" - ) + # Call user_representation + user_representation_response = await get_user_representation( + chat_history=chat_history_str, + session_id=session_id, + user_representation=existing_representation_content, + tom_inference=tom_inference, + method=USER_REPRESENTATION_METHOD, + ) - # Fetch the latest user representation - user_representation_stmt = ( - select(models.Metamessage) - .join( - models.Message, - models.Message.public_id == models.Metamessage.message_id, - ) - .join( - models.Session, - models.Message.session_id == models.Session.public_id, - ) - .join(models.User, models.User.public_id == models.Session.user_id) - .join(models.App, models.App.public_id == models.User.app_id) - .where(models.App.public_id == app_id) - .where(models.User.public_id == user_id) - .where(models.Metamessage.metamessage_type == "user_representation") - .order_by(models.Metamessage.id.desc()) # get the most recent - .limit(1) - ) + # parse the user_representation response + user_representation_response = parse_xml_content( + user_representation_response, "representation" + ) - response = await db.execute(user_representation_stmt) - existing_representation = response.scalar_one_or_none() + # Store the user_representation response as a metamessage + await add_metamessage( + db, + message_id, + "user_representation", + user_representation_response, + ) + await db.commit() - existing_representation_content = ( - existing_representation.content if existing_representation else "None" - ) - - langfuse_context.update_current_trace( - session_id=session_id, - user_id=user_id, - release=os.getenv("SENTRY_RELEASE"), - metadata={"environment": os.getenv("SENTRY_ENVIRONMENT")}, - ) - - # Call user_representation - user_representation_response = await user_representation( - chat_history=f"{ai_message.content}\nhuman: {content}", - session_id=session_id, - user_representation=existing_representation_content, - tom_inference=tom_inference_metamessage.content, - ) - - # Store the user_representation response as a metamessage - await add_metamessage( - db, - message_id, - "user_representation", - user_representation_response, - ) - - # parse the user_representation response - user_representation_response = parse_xml_content( - user_representation_response, "representation" - ) - - console.print( - f"User Representation:\n{user_representation_response}", - style="bright_green", - ) - - else: - raise Exception( - f"\033[91mTom Inference NOT READY YET on message {message_id}" - ) - else: - console.print("No AI message before this user message", style="red") - return + console.print( + f"User Representation:\n{user_representation_response}", + style="bright_green", + ) diff --git a/src/deriver/tom/__init__.py b/src/deriver/tom/__init__.py new file mode 100644 index 00000000..477ab531 --- /dev/null +++ b/src/deriver/tom/__init__.py @@ -0,0 +1,30 @@ +from .conversational import get_tom_inference_conversational, get_user_representation_conversational +from .single_prompt import get_tom_inference_single_prompt, get_user_representation_single_prompt + +async def get_tom_inference(chat_history: str, + session_id: str, + user_representation: str = "None", + method: str = "conversational", + **kwargs + ) -> str: + if method == "conversational": + return await get_tom_inference_conversational(chat_history, session_id, user_representation, **kwargs) + elif method == "single_prompt": + return await get_tom_inference_single_prompt(chat_history, session_id, user_representation, **kwargs) + else: + raise ValueError(f"Invalid method: {method}") + + +async def get_user_representation(chat_history: str, + session_id: str, + user_representation: str = "None", + tom_inference: str = "None", + method: str = "conversational", + **kwargs + ) -> str: + if method == "conversational": + return await get_user_representation_conversational(chat_history, session_id, user_representation, tom_inference, **kwargs) + elif method == "single_prompt": + return await get_user_representation_single_prompt(chat_history, session_id, user_representation, tom_inference, **kwargs) + else: + raise ValueError(f"Invalid method: {method}") \ No newline at end of file diff --git a/src/deriver/voe.py b/src/deriver/tom/conversational.py similarity index 99% rename from src/deriver/voe.py rename to src/deriver/tom/conversational.py index 69b0cd2a..bc604adf 100644 --- a/src/deriver/voe.py +++ b/src/deriver/tom/conversational.py @@ -16,7 +16,7 @@ anthropic = Anthropic( @ai_track("Tom Inference") @observe(as_type="generation") -async def tom_inference( +async def get_tom_inference_conversational( chat_history: str, session_id: str, user_representation: str = "None" ) -> str: with sentry_sdk.start_transaction(op="tom-inference", name="ToM Inference"): @@ -82,7 +82,7 @@ async def tom_inference( @ai_track("User Representation") @observe(as_type="generation") -async def user_representation( +async def get_user_representation_conversational( chat_history: str, session_id: str, user_representation: str = "None", diff --git a/src/deriver/tom/single_prompt.py b/src/deriver/tom/single_prompt.py new file mode 100644 index 00000000..929c6bfd --- /dev/null +++ b/src/deriver/tom/single_prompt.py @@ -0,0 +1,187 @@ +import os + +import sentry_sdk +from anthropic import Anthropic +from langfuse.decorators import langfuse_context, observe +from sentry_sdk.ai.monitoring import ai_track + +# Place the code below at the beginning of your application to initialize the tracer + +# Initialize the Anthropic client +anthropic = Anthropic( + api_key=os.getenv("ANTHROPIC_API_KEY"), + max_retries=5, +) + +ANTHROPIC_MODEL = "claude-3-5-haiku-20241022" + + +@ai_track("Tom Inference") +@observe(as_type="generation") +async def get_tom_inference_single_prompt( + chat_history: str, session_id: str, user_representation: str = "None", **kwargs +) -> str: + with sentry_sdk.start_transaction(op="tom-inference", name="ToM Inference"): + system_prompt = """You are a system for analyzing conversations to make evidence-based inferences about user mental states. + +REQUIREMENTS: +1. Only make inferences that are directly supported by conversation evidence +2. For each inference, cite the specific message that supports it +3. Use uncertainty qualifiers (may, might, possibly) for speculative inferences +4. Do not make assumptions about demographics unless explicitly stated +5. Focus on current mental state and immediate context +6. Consider your own knowledge gaps and violations of expectations (what would surprise you) +7. Always wrap your prediction in tags. + +OUTPUT FORMAT: + +CURRENT STATE: +- Immediate Context: User's current situation +- Active Goals: What user is trying to achieve +- Present Mood: Observable emotional state + +SUPPORTED OBSERVATIONS: +- List only behaviors/preferences with direct evidence +- Format: "OBSERVATION: [detail] (SOURCE: [exact message])" + +TENTATIVE INFERENCES: +- List possible but uncertain interpretations +- Format: "POSSIBLE: [interpretation] (BASIS: [supporting message])" + +KNOWLEDGE GAPS: +- List important unknown information +- Format: "UNKNOWN: [topic/question]" + +EXPECTATION VIOLATIONS: +- Based on the above information, if the next message were to surprise you, what could it contain? +- Format: "POTENTIAL SURPRISE: [possible content] [reason] [confidence level]" +- Include 3-5 possible surprises + +""" + + messages = [ + { + "role": "user", + "content": f"Please analyze this conversation and provide a prediction following the format above:\n{chat_history}", + } + ] + + # Add existing user representation if available + if user_representation != "None": + messages.append( + { + "role": "user", + "content": f"Consider this existing user representation for context, but focus on current state:\n{user_representation}", + } + ) + + langfuse_context.update_current_observation( + input=messages, model=ANTHROPIC_MODEL + ) + message = anthropic.messages.create( + model=ANTHROPIC_MODEL, + max_tokens=1000, + temperature=0, + messages=messages, + system=system_prompt, + ) + print(f"tom_inference in single_prompt.py: {message.content[0].text=}") + message = message.content[0].text + return message + + +@ai_track("User Representation") +@observe(as_type="generation") +async def get_user_representation_single_prompt( + chat_history: str, + session_id: str, + user_representation: str = "None", + tom_inference: str = "None", + **kwargs, +) -> str: + with sentry_sdk.start_transaction( + op="user-representation-inference", name="User Representation" + ): + system_prompt = """You are a system for maintaining factual user representations based on conversation history and theory of mind analysis. + +Your job is to update the existing user representation (if provided) with the new information from the conversation history and theory of mind analysis. + +Copy over information as-is from the existing user representation. Add new information as needed. Only remove content from this section if new information contradicts it. This is especially important for Persistent Information and Tentative Patterns. + +If the existing user representation contains sources, copy them over to the new user representation. + +Sometimes, especially at the beginning of a conversation, the user representation might contain information from previous conversations. In this case, preserve all previous information unless new information contradicts it, especially in regards to traits, interests, style, and other information about the user that is likely to be useful across conversations. + +Always use the format below. If the existing user representation is in another format, convert it to the format below. + +Always wrap your output in tags. + +REQUIREMENTS: +1. Distinguish between temporary states and persistent patterns +2. Only incorporate verified information into core profile +3. Track certainty levels for all information +4. Maintain areas of uncertainty explicitly +5. Update representation incrementally + +OUTPUT FORMAT: + +CURRENT STATE: +- ACTIVE CONTEXT: [detail on situation/activity/location] (SOURCE: [exact message]) # Current situation/activity/location +- TEMPORARY CONDITIONS: [detail on immediate circumstances] (SOURCE: [exact message]) # Immediate circumstances +- PRESENT MOOD/ACTIVITY: [what user is doing right now] (SOURCE: [exact message]) # What user is doing right now + +PERSISTENT INFORMATION: +- STYLE: [pattern] (SOURCE: [exact message]) # Communication style: observed patterns in language use +- STATEMENT: [fact] (SOURCE: [exact message]) # Explicitly stated information + +TENTATIVE PATTERNS: +- LIKELY PATTERN: [pattern] (SOURCE: [exact message]) # Patterns that are almost certain to be true +- POTENTIAL PATTERN: [pattern] (SOURCE: [exact message]) # Patterns that are possible but less likely +- SPECULATIVE PATTERN: [pattern] (SOURCE: [exact message]) # Patterns that are highly uncertain but remotely possible + +KNOWLEDGE GAPS: +- List key missing information +- Note areas needing clarification + +EXPECTATION VIOLATIONS: +- Based on the above information, if the next message were to surprise you, what could it contain? +- Format: "POTENTIAL SURPRISE: [possible content] [reason] [confidence level]" +- Include 3-5 possible surprises + +UPDATES: +- New Information: Recent observations +- Changes: Modified interpretations +- Removals: Information no longer supported + +""" + + messages = [] + + print(f"in single_prompt.py: chat_history: {chat_history}") + print(f"in single_prompt.py: user_representation: {user_representation}") + # Build the context message + context_str = f"CONVERSATION:\n{chat_history}\n\n" + if tom_inference != "None": + context_str += f"PREDICTION OF USER MENTAL STATE - MIGHT BE INCORRECT:\n{tom_inference}\n\n" + if user_representation != "None": + context_str += f"EXISTING USER REPRESENTATION - INCOMPLETE, TO BE UPDATED:\n{user_representation}" + + messages.append( + { + "role": "user", + "content": f"Please analyze this information and provide an updated user representation:\n{context_str}", + } + ) + + langfuse_context.update_current_observation( + input=messages, model=ANTHROPIC_MODEL + ) + message = anthropic.messages.create( + model=ANTHROPIC_MODEL, + max_tokens=1000, + temperature=0, + messages=messages, + system=system_prompt, + ) + message = message.content[0].text + return message