diff --git a/agents-api/agents_api/autogen/Agents.py b/agents-api/agents_api/autogen/Agents.py index 1b66b6a3c..14ede0252 100644 --- a/agents-api/agents_api/autogen/Agents.py +++ b/agents-api/agents_api/autogen/Agents.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Chat.py b/agents-api/agents_api/autogen/Chat.py index 27817568d..601bf3dc7 100644 --- a/agents-api/agents_api/autogen/Chat.py +++ b/agents-api/agents_api/autogen/Chat.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Common.py b/agents-api/agents_api/autogen/Common.py index a2d6b99a6..177214a5f 100644 --- a/agents-api/agents_api/autogen/Common.py +++ b/agents-api/agents_api/autogen/Common.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Docs.py b/agents-api/agents_api/autogen/Docs.py index b029a0acf..c715f4843 100644 --- a/agents-api/agents_api/autogen/Docs.py +++ b/agents-api/agents_api/autogen/Docs.py @@ -1,23 +1,24 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations from typing import Annotated, Any, Literal from uuid import UUID -from pydantic import AwareDatetime, BaseModel, ConfigDict, Field +from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, StrictBool class BaseDocSearchRequest(BaseModel): model_config = ConfigDict( populate_by_name=True, ) - limit: Annotated[int, Field(10, ge=1, le=100)] + limit: Annotated[int, Field(10, ge=1, le=50)] lang: Literal["en-US"] = "en-US" """ The language to be used for text-only search. Support for other languages coming soon. """ + metadata_filter: dict[str, float | str | StrictBool | None] = {} class CreateDocRequest(BaseModel): @@ -109,20 +110,6 @@ class DocSearchResponse(BaseModel): """ -class EmbedQueryRequest(BaseModel): - model_config = ConfigDict( - populate_by_name=True, - ) - text: str | list[str] - """ - Text or texts to embed - """ - embed_instruction: str = "" - """ - Instruction for the embedding model. - """ - - class EmbedQueryResponse(BaseModel): model_config = ConfigDict( populate_by_name=True, @@ -155,6 +142,34 @@ class HybridDocSearchRequest(BaseDocSearchRequest): """ +class MultipleEmbedQueryRequest(BaseModel): + model_config = ConfigDict( + populate_by_name=True, + ) + text: Annotated[list[str], Field(max_length=100, min_length=1)] + """ + Texts to embed + """ + embed_instruction: str = "" + """ + Instruction for the embedding model. + """ + + +class SingleEmbedQueryRequest(BaseModel): + model_config = ConfigDict( + populate_by_name=True, + ) + text: str + """ + Text to embed + """ + embed_instruction: str = "" + """ + Instruction for the embedding model. + """ + + class Snippet(BaseModel): model_config = ConfigDict( populate_by_name=True, diff --git a/agents-api/agents_api/autogen/Entries.py b/agents-api/agents_api/autogen/Entries.py index 1f4286eb9..530209320 100644 --- a/agents-api/agents_api/autogen/Entries.py +++ b/agents-api/agents_api/autogen/Entries.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Executions.py b/agents-api/agents_api/autogen/Executions.py index a4621c0ff..5ccc57e83 100644 --- a/agents-api/agents_api/autogen/Executions.py +++ b/agents-api/agents_api/autogen/Executions.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Jobs.py b/agents-api/agents_api/autogen/Jobs.py index 568b7a09c..fc231d6e5 100644 --- a/agents-api/agents_api/autogen/Jobs.py +++ b/agents-api/agents_api/autogen/Jobs.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Sessions.py b/agents-api/agents_api/autogen/Sessions.py index 858c8a5a3..6869e3ef1 100644 --- a/agents-api/agents_api/autogen/Sessions.py +++ b/agents-api/agents_api/autogen/Sessions.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Tasks.py b/agents-api/agents_api/autogen/Tasks.py index 77dcfefd6..fdbfc5811 100644 --- a/agents-api/agents_api/autogen/Tasks.py +++ b/agents-api/agents_api/autogen/Tasks.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Tools.py b/agents-api/agents_api/autogen/Tools.py index 423896e89..2b6010b1c 100644 --- a/agents-api/agents_api/autogen/Tools.py +++ b/agents-api/agents_api/autogen/Tools.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/Users.py b/agents-api/agents_api/autogen/Users.py index 6eeb1783d..76af9bbdd 100644 --- a/agents-api/agents_api/autogen/Users.py +++ b/agents-api/agents_api/autogen/Users.py @@ -1,5 +1,5 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml from __future__ import annotations diff --git a/agents-api/agents_api/autogen/__init__.py b/agents-api/agents_api/autogen/__init__.py index 93bca4729..3d9935180 100644 --- a/agents-api/agents_api/autogen/__init__.py +++ b/agents-api/agents_api/autogen/__init__.py @@ -1,2 +1,2 @@ # generated by datamodel-codegen: -# filename: openapi-0.4.0.yaml +# filename: openapi-1.0.0.yaml diff --git a/agents-api/agents_api/models/docs/search_docs_by_embedding.py b/agents-api/agents_api/models/docs/search_docs_by_embedding.py index e346b6b69..7f8bdaa61 100644 --- a/agents-api/agents_api/models/docs/search_docs_by_embedding.py +++ b/agents-api/agents_api/models/docs/search_docs_by_embedding.py @@ -1,5 +1,6 @@ """This module contains functions for searching documents in the CozoDB based on embedding queries.""" +import json from typing import Any, Literal, TypeVar from uuid import UUID @@ -49,9 +50,11 @@ def search_docs_by_embedding( k: int = 3, confidence: float = 0.5, ef: int = 50, - mmr_lambda: float = 0.5, + mmr_strength: float = 0.0, embedding_size: int = 1024, -) -> tuple[list[str], dict]: + ann_threshold: int = 1_000_000, + metadata_filter: dict[str, Any] = {}, +) -> tuple[str, dict]: """ Searches for document snippets in CozoDB by embedding query. @@ -62,10 +65,22 @@ def search_docs_by_embedding( k (int, optional): The number of nearest neighbors to retrieve. Defaults to 3. confidence (float, optional): The confidence threshold for filtering results. Defaults to 0.8. mmr_lambda (float, optional): The lambda parameter for MMR. Defaults to 0.25. + embedding_size (int): Embedding vector length + metadata_filter (dict[str, Any]): Dictionary to filter agents based on metadata. """ assert len(query_embedding) == embedding_size assert sum(query_embedding) + assert 0 <= mmr_strength < 1, "MMR strength must be in [0, 1) interval" + + mmr_lambda: float = 1 - mmr_strength + + metadata_filter_str = ", ".join( + [ + f"metadata->{json.dumps(k)} == {json.dumps(v)}" + for k, v in metadata_filter.items() + ] + ) owners: list[list[str]] = [ [owner_type, str(owner_id)] for owner_type, owner_id in owners @@ -74,93 +89,213 @@ def search_docs_by_embedding( # Calculate the search radius based on confidence level radius: float = 1.0 - confidence - # Construct the datalog query for searching document snippets - interim_query = f""" + determine_knn_ann_query = f""" owners[owner_type, owner_id] <- $owners - input[ - owner_type, - owner_id, - query_embedding, - ] := + snippet_counter[count(item)] := owners[owner_type, owner_id_str], owner_id = to_uuid(owner_id_str), - query_embedding = vec($query_embedding) - - candidate[doc_id] := - input[owner_type, owner_id, _], *docs {{ owner_type, owner_id, - doc_id + doc_id: item, + metadata, }} + {', ' + metadata_filter_str if metadata_filter_str.strip() else ''} + + ?[use_ann] := + snippet_counter[count], + count > {ann_threshold}, + use_ann = true + + :limit 1 + :create _determine_knn_ann {{ + use_ann + }} + """ + + # Construct the datalog query for searching document snippets + search_query = f""" + # %debug _determine_knn_ann + %if {{ + ?[use_ann] := *_determine_knn_ann{{ use_ann }} + }} + + %then {{ + owners[owner_type, owner_id] <- $owners + input[ + owner_type, + owner_id, + query_embedding, + ] := + owners[owner_type, owner_id_str], + owner_id = to_uuid(owner_id_str), + query_embedding = vec($query_embedding) + + # Search for documents by owner + ?[ + doc_id, + index, + title, + content, + distance, + ] := + # Get input values + input[owner_type, owner_id, query], + + # Restrict the search to all documents that match the owner + *docs {{ + owner_type, + owner_id, + doc_id, + title, + }}, + + # Search for snippets in the embedding space + ~snippets:embedding_space {{ + doc_id, + index, + content + | + query: query, + k: {k*(3 if mmr_strength else 1)}, # Get more candidates for diversity + ef: {ef}, + radius: {radius}, + bind_distance: distance, + }} + + :create _search_result {{ + doc_id, + index, + title, + content, + distance, + }} + }} + + %else {{ + owners[owner_type, owner_id] <- $owners + input[ + owner_type, + owner_id, + query_embedding, + ] := + owners[owner_type, owner_id_str], + owner_id = to_uuid(owner_id_str), + query_embedding = vec($query_embedding) + + # Search for documents by owner + ?[ + doc_id, + index, + title, + content, + distance, + ] := + # Get input values + input[owner_type, owner_id, query], + + # Restrict the search to all documents that match the owner + *docs {{ + owner_type, + owner_id, + doc_id, + title, + }}, + + # Search for snippets in the embedding space + *snippets {{ + doc_id, + index, + content, + embedding, + }}, + !is_null(embedding), + distance = cos_dist(query, embedding), + distance <= {radius} + + :create _search_result {{ + doc_id, + index, + title, + content, + distance, + }} + }} + %end + """ + + normal_interim_query = f""" + owners[owner_type, owner_id] <- $owners + + ?[ + owner_type, + owner_id, + doc_id, + snippet_data, + distance, + mmr_score, + title, + ] := + owners[owner_type, owner_id_str], + owner_id = to_uuid(owner_id_str), + *_search_result{{ doc_id, index, title, content, distance }}, + mmr_score = distance, + snippet_data = [index, content] + # Sort the results by distance to find the closest matches + :sort -mmr_score + :limit {k} + + :create _interim {{ + owner_type, + owner_id, + doc_id, + snippet_data, + distance, + mmr_score, + title, + }} + """ + + mmr_interim_query = f""" + owners[owner_type, owner_id] <- $owners + + # Calculate the min distance between every doc and every snippet being compared intersnippet_distance[ doc_id, index1, min(dist) ] := - candidate[doc_id], + *_search_result{{ doc_id: doc_id2, index: index2 }}, *snippets {{ doc_id, index: index1, embedding: embedding1 }}, *snippets {{ - doc_id, + doc_id: doc_id2, index: index2, embedding: embedding2 }}, is_null(embedding1) == false, is_null(embedding2) == false, - index1 < index2, - dist = cos_dist(embedding1, embedding2) - doclength[doc_id, max(index)] := - candidate[doc_id], - *snippets {{ - doc_id, - index, - }} - - get_intersnippet[doc_id, index, distance] := - candidate[doc_id], - intersnippet_distance[doc_id, _, distance] - - get_intersnippet[doc_id, index, distance] := - candidate[doc_id], - not intersnippet_distance[doc_id, _, distance], - distance = 0.0 + # When doc_id == doc_id2, dont compare the same snippet + doc_id != doc_id2 || index1 != index2, + dist = cos_dist(embedding1, embedding2) - search_result[ - doc_id, - content, - index, - distance, - ] := - input[_, __, query], - candidate[doc_id], - ~snippets:embedding_space {{ - doc_id, - index, - content - | - query: query, - k: {k*2}, - ef: {ef}, - radius: {radius}, - bind_distance: distance, - }} apply_mmr[ doc_id, + title, snippet_data, distance, mmr_score, ] := - candidate[doc_id], - search_result[doc_id, content, index, distance], - get_intersnippet[doc_id, index, intersnippet_distance], - mmr_score = {mmr_lambda} * (distance - (1.0 - {mmr_lambda}) * intersnippet_distance), + *_search_result{{ doc_id, index, title, content, distance: original_distance }}, + intersnippet_distance[doc_id, index, intersnippet_distance], + mmr_score = ({mmr_lambda} * original_distance) - ((1.0 - {mmr_lambda}) * intersnippet_distance), + distance = max(0.0, min(1.0 - mmr_score, 1.0)), snippet_data = [index, content] ?[ @@ -172,15 +307,12 @@ def search_docs_by_embedding( mmr_score, title, ] := - candidate[doc_id], - *docs {{ - owner_type, - owner_id, - doc_id, - title, - }}, + owners[owner_type, owner_id_str], + owner_id = to_uuid(owner_id_str), + apply_mmr[ doc_id, + title, snippet_data, distance, mmr_score, @@ -258,20 +390,28 @@ def search_docs_by_embedding( ] """ - queries = [ - verify_developer_id_query(developer_id), - *[ - verify_developer_owns_resource_query( - developer_id, f"{owner_type}s", **{f"{owner_type}_id": owner_id} - ) - for owner_type, owner_id in owners - ], - interim_query, - collect_query, - ] + verify_query = "}\n\n{".join( + [ + verify_developer_id_query(developer_id), + *[ + verify_developer_owns_resource_query( + developer_id, f"{owner_type}s", **{f"{owner_type}_id": owner_id} + ) + for owner_type, owner_id in owners + ], + ] + ) + + query = f""" + {{ {verify_query} }} + {{ {determine_knn_ann_query} }} + {search_query} + {{ {normal_interim_query if mmr_strength == 0.0 else mmr_interim_query} }} + {{ {collect_query} }} + """ return ( - queries, + query, { "owners": owners, "query_embedding": query_embedding, diff --git a/agents-api/agents_api/models/docs/search_docs_by_text.py b/agents-api/agents_api/models/docs/search_docs_by_text.py index 34ee8cb00..9f558d2d4 100644 --- a/agents-api/agents_api/models/docs/search_docs_by_text.py +++ b/agents-api/agents_api/models/docs/search_docs_by_text.py @@ -1,5 +1,6 @@ """This module contains functions for searching documents in the CozoDB based on embedding queries.""" +import json import re from typing import Any, Literal, TypeVar from uuid import UUID @@ -49,6 +50,7 @@ def search_docs_by_text( owners: list[tuple[Literal["user", "agent"], UUID]], query: str, k: int = 3, + metadata_filter: dict[str, Any] = {}, ) -> tuple[list[str], dict]: """ Searches for document snippets in CozoDB by embedding query. @@ -57,7 +59,14 @@ def search_docs_by_text( owners (list[tuple[Literal["user", "agent"], UUID]]): The type of the owner of the documents. query (str): The query string. k (int, optional): The number of nearest neighbors to retrieve. Defaults to 3. + metadata_filter (dict[str, Any]): Dictionary to filter agents based on metadata. """ + metadata_filter_str = ", ".join( + [ + f"metadata->{json.dumps(k)} == {json.dumps(v)}" + for k, v in metadata_filter.items() + ] + ) owners: list[list[str]] = [ [owner_type, str(owner_id)] for owner_type, owner_id in owners @@ -83,8 +92,10 @@ def search_docs_by_text( *docs {{ owner_type, owner_id, - doc_id + doc_id, + metadata, }} + {', ' + metadata_filter_str if metadata_filter_str.strip() else ''} search_result[ doc_id, diff --git a/agents-api/agents_api/models/docs/search_docs_hybrid.py b/agents-api/agents_api/models/docs/search_docs_hybrid.py index 598600511..1a682751e 100644 --- a/agents-api/agents_api/models/docs/search_docs_hybrid.py +++ b/agents-api/agents_api/models/docs/search_docs_hybrid.py @@ -1,7 +1,7 @@ """This module contains functions for searching documents in the CozoDB based on embedding queries.""" from statistics import mean, stdev -from typing import Literal +from typing import Any, Literal from uuid import UUID from beartype import beartype @@ -100,6 +100,7 @@ def search_docs_hybrid( alpha: float = 0.7, # Weight of the embedding search results (this is a good default) embed_search_options: dict = {}, text_search_options: dict = {}, + metadata_filter: dict[str, Any] = {}, ) -> list[DocReference]: # TODO: We should probably parallelize these queries text_results = search_docs_by_text( @@ -107,6 +108,7 @@ def search_docs_hybrid( owners=owners, query=query, k=2 * k, + metadata_filter=metadata_filter, **text_search_options, ) @@ -115,6 +117,7 @@ def search_docs_hybrid( owners=owners, query_embedding=query_embedding, k=2 * k, + metadata_filter=metadata_filter, **embed_search_options, ) diff --git a/agents-api/agents_api/routers/docs/embed.py b/agents-api/agents_api/routers/docs/embed.py index ba35b2dbb..1c13a1297 100644 --- a/agents-api/agents_api/routers/docs/embed.py +++ b/agents-api/agents_api/routers/docs/embed.py @@ -4,8 +4,9 @@ from fastapi import Depends from ...autogen.openapi_model import ( - EmbedQueryRequest, EmbedQueryResponse, + MultipleEmbedQueryRequest, + SingleEmbedQueryRequest, ) from ...clients import litellm from ...dependencies.developer_id import get_developer_id @@ -15,7 +16,7 @@ @router.post("/embed", tags=["docs"]) async def embed( x_developer_id: Annotated[UUID, Depends(get_developer_id)], - data: EmbedQueryRequest, + data: SingleEmbedQueryRequest | MultipleEmbedQueryRequest, ) -> EmbedQueryResponse: text_to_embed: str | list[str] = data.text text_to_embed: list[str] = ( diff --git a/agents-api/agents_api/routers/docs/search_docs.py b/agents-api/agents_api/routers/docs/search_docs.py index ce0b62811..bab2875f5 100644 --- a/agents-api/agents_api/routers/docs/search_docs.py +++ b/agents-api/agents_api/routers/docs/search_docs.py @@ -25,21 +25,28 @@ def get_search_fn_and_params( search_fn, params = None, None match search_params: - case TextOnlyDocSearchRequest(text=query, limit=k): + case TextOnlyDocSearchRequest( + text=query, limit=k, metadata_filter=metadata_filter + ): search_fn = search_docs_by_text params = dict( query=query, k=k, + metadata_filter=metadata_filter, ) case VectorDocSearchRequest( - vector=query_embedding, limit=k, confidence=confidence + vector=query_embedding, + limit=k, + confidence=confidence, + metadata_filter=metadata_filter, ): search_fn = search_docs_by_embedding params = dict( query_embedding=query_embedding, k=k, confidence=confidence, + metadata_filter=metadata_filter, ) case HybridDocSearchRequest( @@ -48,6 +55,7 @@ def get_search_fn_and_params( limit=k, confidence=confidence, alpha=alpha, + metadata_filter=metadata_filter, ): search_fn = search_docs_hybrid params = dict( @@ -56,6 +64,7 @@ def get_search_fn_and_params( k=k, embed_search_options=dict(confidence=confidence), alpha=alpha, + metadata_filter=metadata_filter, ) return search_fn, params diff --git a/agents-api/docker-compose.yml b/agents-api/docker-compose.yml index 40775abde..23cb6dd61 100644 --- a/agents-api/docker-compose.yml +++ b/agents-api/docker-compose.yml @@ -52,6 +52,11 @@ x--base-agents-api: &base-agents-api target: /app/agents_api ignore: - ./**/*.pyc + - action: sync+restart + path: ./gunicorn_conf.py + target: /app/gunicorn_conf.py + ignore: + - ./gunicorn_conf.pyc - action: rebuild path: poetry.lock - action: rebuild diff --git a/agents-api/gunicorn_conf.py b/agents-api/gunicorn_conf.py index 1ecc02d9c..f50b39c3d 100644 --- a/agents-api/gunicorn_conf.py +++ b/agents-api/gunicorn_conf.py @@ -1,9 +1,10 @@ import multiprocessing # Gunicorn config variables -workers = multiprocessing.cpu_count() * 2 + 1 +workers = multiprocessing.cpu_count() - 1 worker_class = "uvicorn.workers.UvicornWorker" bind = "0.0.0.0:8080" keepalive = 120 +timeout = 120 errorlog = "-" accesslog = "-" diff --git a/openapi.yaml b/openapi.yaml index f381c1085..9bb592e6d 120000 --- a/openapi.yaml +++ b/openapi.yaml @@ -1 +1 @@ -typespec/tsp-output/@typespec/openapi3/openapi-0.4.0.yaml \ No newline at end of file +typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml \ No newline at end of file diff --git a/typespec/docs/models.tsp b/typespec/docs/models.tsp index dca287222..f1d7318aa 100644 --- a/typespec/docs/models.tsp +++ b/typespec/docs/models.tsp @@ -62,14 +62,26 @@ model DocReference { distance: float | null = null; } -model EmbedQueryRequest { - /** Text or texts to embed */ - text: string | string[]; +model SingleEmbedQueryRequest { + /** Text to embed */ + text: string; + + /** Instruction for the embedding model. */ + embed_instruction: string = ""; +} + +model MultipleEmbedQueryRequest { + /** Texts to embed */ + @minItems(1) + @maxItems(100) + text: string[]; /** Instruction for the embedding model. */ embed_instruction: string = ""; } +alias EmbedQueryRequest = SingleEmbedQueryRequest | MultipleEmbedQueryRequest; + model EmbedQueryResponse { /** The embedded vectors */ vectors: float[][]; @@ -77,11 +89,12 @@ model EmbedQueryResponse { model BaseDocSearchRequest { @minValue(1) - @maxValue(100) + @maxValue(50) limit: uint16 = 10; /** The language to be used for text-only search. Support for other languages coming soon. */ lang: "en-US" = "en-US"; + metadata_filter: MetadataFilter = #{}, } model VectorDocSearchRequest extends BaseDocSearchRequest { diff --git a/typespec/tsp-output/@typespec/openapi3/openapi-0.4.0.yaml b/typespec/tsp-output/@typespec/openapi3/openapi-0.4.0.yaml deleted file mode 100644 index 72628ab49..000000000 --- a/typespec/tsp-output/@typespec/openapi3/openapi-0.4.0.yaml +++ /dev/null @@ -1,6255 +0,0 @@ -openapi: 3.0.0 -info: - title: Julep API - termsOfService: https://julep.ai/terms - contact: - name: Julep AI - url: https://julep.ai - email: developers@julep.ai - license: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html - summary: A backend for creating stateful AI apps - description: Julep is a backend for creating stateful AI apps with background tasks and long-term memory easily. - version: 0.4.0 -externalDocs: - url: https://docs.julep.ai - description: Julep API documentation -tags: [] -paths: - /agents: - get: - operationId: AgentsRoute_list - description: List Agents (paginated) - parameters: - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Agents.Agent' - required: - - items - post: - operationId: AgentsRoute_create - description: Create a new Agent - parameters: [] - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.CreateAgentRequest' - /agents/{id}: - post: - operationId: AgentsRoute_createOrUpdate - description: Create or update an Agent - parameters: - - $ref: '#/components/parameters/Agents.CreateOrUpdateAgentRequest.id' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.UpdateAgentRequest' - put: - operationId: AgentsRoute_update - description: Update an existing Agent by id (overwrites existing values; use PATCH for merging instead) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.UpdateAgentRequest' - patch: - operationId: AgentsRoute_patch - description: Update an existing Agent by id (merges with existing values) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.PatchAgentRequest' - delete: - operationId: AgentsRoute_delete - description: Delete Agent by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - get: - operationId: AgentsRoute_get - description: Get an Agent by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.Agent' - /agents/{id}/docs: - get: - operationId: AgentDocsRoute_list - description: List Docs owned by an Agent - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Docs.Doc' - required: - - items - post: - operationId: AgentDocsRoute_create - description: Create a Doc for this Agent - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.CreateDocRequest' - /agents/{id}/docs/{child_id}: - delete: - operationId: AgentDocsRoute_delete - description: Delete a Doc for this Agent - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be deleted - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - /agents/{id}/search: - post: - operationId: AgentsDocsSearchRoute_search - description: Search Docs owned by an Agent - parameters: - - name: id - in: path - required: true - description: ID of the parent - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.DocSearchResponse' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - body: - anyOf: - - $ref: '#/components/schemas/Docs.VectorDocSearchRequest' - - $ref: '#/components/schemas/Docs.TextOnlyDocSearchRequest' - - $ref: '#/components/schemas/Docs.HybridDocSearchRequest' - required: - - body - /agents/{id}/tasks: - get: - operationId: TasksRoute_list - description: List tasks (paginated) - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Tasks.Task' - required: - - items - post: - operationId: TasksRoute_create - description: Create a new task - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - text/x-yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - text/yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - application/json: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - /agents/{id}/tasks/{child_id}: - put: - operationId: TasksRoute_update - description: Update an existing task (overwrite existing values) - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be updated - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Tasks.UpdateTaskRequest' - patch: - operationId: TasksRoute_patch - description: Update an existing task (merges with existing values) - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be patched - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Tasks.PatchTaskRequest' - delete: - operationId: TasksRoute_delete - description: Delete a task by its id - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be deleted - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - /agents/{id}/tools: - get: - operationId: AgentToolsRoute_list - description: List tools of the given agent - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Tools.Tool' - required: - - items - post: - operationId: AgentToolsRoute_create - description: Create a new tool for this agent - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Agents.CreateAgentRequest' - /agents/{id}/tools/{child_id}: - put: - operationId: AgentToolsRoute_update - description: Update an existing tool (overwrite existing values) - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be updated - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Tools.UpdateToolRequest' - patch: - operationId: AgentToolsRoute_patch - description: Update an existing tool (merges with existing values) - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be patched - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Tools.PatchToolRequest' - delete: - operationId: AgentToolsRoute_delete - description: Delete an existing tool by id - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be deleted - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - /agents/{parent_id}/tasks/{id}: - post: - operationId: TasksCreateOrUpdateRoute_createOrUpdate - description: Create or update a task - parameters: - - name: parent_id - in: path - required: true - description: ID of the agent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Tasks.CreateOrUpdateTaskRequest.id' - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - text/x-yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - text/yaml: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - application/json: - schema: - $ref: '#/components/schemas/Tasks.CreateTaskRequest' - /docs/{id}: - get: - operationId: IndividualDocsRoute_get - description: Get Doc by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.Doc' - /embed: - post: - operationId: EmbedRoute_embed - description: Embed a query for search - parameters: [] - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.EmbedQueryResponse' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - body: - $ref: '#/components/schemas/Docs.EmbedQueryRequest' - required: - - body - /executions: - post: - operationId: ExecutionsRoute_resumeWithTaskToken - description: Resume an execution with a task token - parameters: - - name: task_token - in: query - required: true - description: A Task Token is a unique identifier for a specific Task Execution. - schema: - type: string - explode: false - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Executions.TaskTokenResumeExecutionRequest' - description: Request to resume an execution with a task token - security: - - {} - /executions/{id}: - get: - operationId: ExecutionsRoute_get - description: Get an Execution by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Executions.Execution' - put: - operationId: ExecutionsRoute_update - description: Update an existing Execution - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Executions.UpdateExecutionRequest' - /executions/{id}/transitions: - get: - operationId: ExecutionTransitionsRoute_list - description: List the Transitions of an Execution by id - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - type: object - properties: - transitions: - type: array - items: - $ref: '#/components/schemas/Executions.Transition' - required: - - transitions - required: - - items - /executions/{id}/transitions.stream: - get: - operationId: ExecutionTransitionsStreamRoute_stream - description: Stream events emitted by the given execution - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - name: next_token - in: query - required: true - description: Next page token - schema: - type: string - nullable: true - default: null - explode: false - responses: - '200': - description: The request has succeeded. - content: - text/event-stream: - schema: - type: string - /jobs/{id}: - get: - operationId: JobRoute_get - description: Get the status of an existing Job by its id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Jobs.JobStatus' - /sessions: - get: - operationId: SessionsRoute_list - description: List sessions (paginated) - parameters: - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Sessions.Session' - required: - - items - post: - operationId: SessionsRoute_create - description: Create a new session - parameters: [] - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Sessions.CreateSessionRequest' - /sessions/{id}: - post: - operationId: SessionsRoute_createOrUpdate - description: Create or update a session - parameters: - - $ref: '#/components/parameters/Sessions.CreateOrUpdateSessionRequest.id' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Sessions.CreateSessionRequest' - put: - operationId: SessionsRoute_update - description: Update an existing session by its id (overwrites all existing values) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Sessions.UpdateSessionRequest' - patch: - operationId: SessionsRoute_patch - description: Update an existing session by its id (merges with existing values) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Sessions.PatchSessionRequest' - delete: - operationId: SessionsRoute_delete - description: Delete a session by its id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - get: - operationId: SessionsRoute_get - description: Get a session by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Sessions.Session' - /sessions/{id}/chat: - post: - operationId: ChatRoute_generate - description: Generate a response from the model - parameters: - - name: id - in: path - required: true - description: The session ID - schema: - $ref: '#/components/schemas/Common.uuid' - - name: x-custom-api-key - in: header - required: false - description: Custom API key - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/Chat.ChunkChatResponse' - - $ref: '#/components/schemas/Chat.MessageChatResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Chat.ChatInput' - description: Request to generate a response from the model - /sessions/{id}/history: - delete: - operationId: HistoryRoute_delete - description: Clear the history of a Session (resets the Session) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - get: - operationId: HistoryRoute_history - description: Get history of a Session - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Entries.History' - /tasks/{id}: - get: - operationId: TasksGetRoute_get - description: Get a task by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Tasks.Task' - /tasks/{id}/executions: - post: - operationId: TaskExecutionsRoute_create - description: Create an execution for the given task - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Executions.CreateExecutionRequest' - get: - operationId: TaskExecutionsRoute_list - description: List executions of the given task - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Executions.Execution' - required: - - items - /users: - get: - operationId: UsersRoute_list - description: List users (paginated) - parameters: - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Users.User' - required: - - items - post: - operationId: UsersRoute_create - description: Create a new user - parameters: [] - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Users.CreateUserRequest' - /users/{id}: - post: - operationId: UsersRoute_createOrUpdate - description: Create or update a user - parameters: - - $ref: '#/components/parameters/Users.CreateOrUpdateUserRequest' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Users.CreateUserRequest' - put: - operationId: UsersRoute_update - description: Update an existing user by id (overwrite existing values) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Users.UpdateUserRequest' - patch: - operationId: UsersRoute_patch - description: Update an existing user by id (merge with existing values) - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceUpdatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Users.PatchUserRequest' - delete: - operationId: UsersRoute_delete - description: Delete a user by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - get: - operationId: UsersRoute_get - description: Get a user by id - parameters: - - name: id - in: path - required: true - description: ID of the resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Users.User' - /users/{id}/docs: - get: - operationId: UserDocsRoute_list - description: List Docs owned by a User - parameters: - - name: id - in: path - required: true - description: ID of parent - schema: - $ref: '#/components/schemas/Common.uuid' - - $ref: '#/components/parameters/Common.PaginationOptions.limit' - - $ref: '#/components/parameters/Common.PaginationOptions.offset' - - $ref: '#/components/parameters/Common.PaginationOptions.sort_by' - - $ref: '#/components/parameters/Common.PaginationOptions.direction' - - $ref: '#/components/parameters/Common.PaginationOptions.metadata_filter' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Docs.Doc' - required: - - items - post: - operationId: UserDocsRoute_create - description: Create a Doc for this User - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '201': - description: The request has succeeded and a new resource has been created as a result. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceCreatedResponse' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.CreateDocRequest' - /users/{id}/docs/{child_id}: - delete: - operationId: UserDocsRoute_delete - description: Delete a Doc for this User - parameters: - - name: id - in: path - required: true - description: ID of parent resource - schema: - $ref: '#/components/schemas/Common.uuid' - - name: child_id - in: path - required: true - description: ID of the resource to be deleted - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '202': - description: The request has been accepted for processing, but processing has not yet completed. - content: - application/json: - schema: - $ref: '#/components/schemas/Common.ResourceDeletedResponse' - /users/{id}/search: - post: - operationId: UserDocsSearchRoute_search - description: Search Docs owned by a User - parameters: - - name: id - in: path - required: true - description: ID of the parent - schema: - $ref: '#/components/schemas/Common.uuid' - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/Docs.DocSearchResponse' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - body: - anyOf: - - $ref: '#/components/schemas/Docs.VectorDocSearchRequest' - - $ref: '#/components/schemas/Docs.TextOnlyDocSearchRequest' - - $ref: '#/components/schemas/Docs.HybridDocSearchRequest' - required: - - body -security: - - ApiKeyAuth: [] - - ApiKeyAuth_: [] -components: - parameters: - Agents.CreateOrUpdateAgentRequest.id: - name: id - in: path - required: true - schema: - $ref: '#/components/schemas/Common.uuid' - Common.PaginationOptions.direction: - name: direction - in: query - required: true - description: Sort direction - schema: - type: string - enum: - - asc - - desc - default: asc - explode: false - Common.PaginationOptions.limit: - name: limit - in: query - required: true - description: Limit the number of items returned - schema: - $ref: '#/components/schemas/Common.limit' - default: 100 - explode: false - Common.PaginationOptions.metadata_filter: - name: metadata_filter - in: query - required: true - description: Object to filter results by metadata - schema: - type: object - additionalProperties: - anyOf: - - type: number - - type: string - - type: boolean - nullable: true - explode: false - Common.PaginationOptions.offset: - name: offset - in: query - required: true - description: Offset the items returned - schema: - $ref: '#/components/schemas/Common.offset' - default: 0 - explode: false - Common.PaginationOptions.sort_by: - name: sort_by - in: query - required: true - description: Sort by a field - schema: - type: string - enum: - - created_at - - updated_at - default: created_at - explode: false - Sessions.CreateOrUpdateSessionRequest.id: - name: id - in: path - required: true - schema: - $ref: '#/components/schemas/Common.uuid' - Tasks.CreateOrUpdateTaskRequest.id: - name: id - in: path - required: true - schema: - $ref: '#/components/schemas/Common.uuid' - Users.CreateOrUpdateUserRequest: - name: id - in: path - required: true - schema: - $ref: '#/components/schemas/Common.uuid' - schemas: - Agents.Agent: - type: object - required: - - id - - created_at - - updated_at - - name - - about - - model - - instructions - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - metadata: - type: object - additionalProperties: {} - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the agent - default: '' - about: - type: string - description: About the agent - default: '' - model: - type: string - description: Model name to use (gpt-4-turbo, gemini-nano etc) - default: '' - instructions: - anyOf: - - type: string - - type: array - items: - type: string - description: Instructions for the agent - default: [] - default_settings: - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - description: Default settings for all sessions created by this agent - Agents.CreateAgentRequest: - type: object - required: - - name - - about - - model - - instructions - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the agent - default: '' - about: - type: string - description: About the agent - default: '' - model: - type: string - description: Model name to use (gpt-4-turbo, gemini-nano etc) - default: '' - instructions: - anyOf: - - type: string - - type: array - items: - type: string - description: Instructions for the agent - default: [] - default_settings: - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - description: Default settings for all sessions created by this agent - description: Payload for creating a agent (and associated documents) - Agents.CreateOrUpdateAgentRequest: - type: object - required: - - id - - name - - about - - model - - instructions - properties: - id: - $ref: '#/components/schemas/Common.uuid' - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the agent - default: '' - about: - type: string - description: About the agent - default: '' - model: - type: string - description: Model name to use (gpt-4-turbo, gemini-nano etc) - default: '' - instructions: - anyOf: - - type: string - - type: array - items: - type: string - description: Instructions for the agent - default: [] - default_settings: - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - description: Default settings for all sessions created by this agent - allOf: - - $ref: '#/components/schemas/Agents.CreateAgentRequest' - Agents.PatchAgentRequest: - type: object - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the agent - default: '' - about: - type: string - description: About the agent - default: '' - model: - type: string - description: Model name to use (gpt-4-turbo, gemini-nano etc) - default: '' - instructions: - anyOf: - - type: string - - type: array - items: - type: string - description: Instructions for the agent - default: [] - default_settings: - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - description: Default settings for all sessions created by this agent - description: Payload for patching a agent - Agents.UpdateAgentRequest: - type: object - required: - - name - - about - - model - - instructions - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the agent - default: '' - about: - type: string - description: About the agent - default: '' - model: - type: string - description: Model name to use (gpt-4-turbo, gemini-nano etc) - default: '' - instructions: - anyOf: - - type: string - - type: array - items: - type: string - description: Instructions for the agent - default: [] - default_settings: - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - description: Default settings for all sessions created by this agent - description: Payload for updating a agent - Chat.BaseChatOutput: - type: object - required: - - index - - finish_reason - properties: - index: - type: integer - format: uint32 - finish_reason: - allOf: - - $ref: '#/components/schemas/Chat.FinishReason' - description: The reason the model stopped generating tokens - default: stop - logprobs: - allOf: - - $ref: '#/components/schemas/Chat.LogProbResponse' - description: The log probabilities of tokens - Chat.BaseChatResponse: - type: object - required: - - jobs - - docs - - created_at - - id - properties: - usage: - allOf: - - $ref: '#/components/schemas/Chat.CompetionUsage' - description: Usage statistics for the completion request - jobs: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - description: Background job IDs that may have been spawned from this interaction. - default: [] - readOnly: true - docs: - type: array - items: - $ref: '#/components/schemas/Docs.DocReference' - description: Documents referenced for this request (for citation purposes). - default: [] - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - Chat.BaseTokenLogProb: - type: object - required: - - token - - logprob - properties: - token: - type: string - logprob: - type: number - format: float - description: The log probability of the token - bytes: - type: array - items: - type: integer - format: uint16 - Chat.ChatInput: - type: object - required: - - remember - - recall - - save - - stream - - stop - properties: - remember: - type: boolean - description: 'DISABLED: Whether this interaction should form new memories or not (will be enabled in a future release)' - default: false - readOnly: true - recall: - type: boolean - description: Whether previous memories and docs should be recalled or not - default: true - save: - type: boolean - description: Whether this interaction should be stored in the session history or not - default: true - model: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Identifier of the model to be used - stream: - type: boolean - description: Indicates if the server should stream the response as it's generated - default: false - stop: - type: array - items: - type: string - maxItems: 4 - description: Up to 4 sequences where the API will stop generating further tokens. - default: [] - seed: - type: integer - format: int16 - minimum: -1 - maximum: 1000 - description: If specified, the system will make a best effort to sample deterministically for that particular seed value - max_tokens: - type: integer - format: uint32 - minimum: 1 - description: The maximum number of tokens to generate in the chat completion - logit_bias: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.logit_bias' - description: Modify the likelihood of specified tokens appearing in the completion - response_format: - anyOf: - - $ref: '#/components/schemas/Chat.SimpleCompletionResponseFormat' - - $ref: '#/components/schemas/Chat.SchemaCompletionResponseFormat' - description: Response format (set to `json_object` to restrict output to JSON) - agent: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Agent ID of the agent to use for this interaction. (Only applicable for multi-agent sessions) - repetition_penalty: - type: number - format: float - minimum: 0 - maximum: 2 - description: Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - length_penalty: - type: number - format: float - minimum: 0 - maximum: 2 - description: Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize number of tokens generated. - min_p: - type: number - format: float - minimum: 0 - maximum: 1 - description: Minimum probability compared to leading token to be considered - frequency_penalty: - type: number - format: float - minimum: -2 - maximum: 2 - description: Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - presence_penalty: - type: number - format: float - minimum: -2 - maximum: 2 - description: Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - temperature: - type: number - format: float - minimum: 0 - maximum: 5 - description: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - top_p: - type: number - format: float - minimum: 0 - maximum: 1 - description: Defaults to 1 An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. - allOf: - - $ref: '#/components/schemas/Chat.ChatInputData' - Chat.ChatInputData: - type: object - required: - - messages - - tools - properties: - messages: - type: array - items: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - continue: - type: boolean - description: Whether to continue this message or return a new one - minItems: 1 - description: A list of new input messages comprising the conversation so far. - tools: - type: array - items: - $ref: '#/components/schemas/Tools.Tool' - description: (Advanced) List of tools that are provided in addition to agent's default set of tools. - default: [] - tool_choice: - anyOf: - - type: string - enum: - - auto - - none - - $ref: '#/components/schemas/Tools.NamedToolChoice' - description: Can be one of existing tools given to the agent earlier or the ones provided in this request. - Chat.ChatOutputChunk: - type: object - required: - - delta - properties: - delta: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - continue: - type: boolean - description: Whether to continue this message or return a new one - description: The message generated by the model - allOf: - - $ref: '#/components/schemas/Chat.BaseChatOutput' - description: Streaming chat completion output - Chat.ChatSettings: - type: object - required: - - stream - - stop - properties: - model: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Identifier of the model to be used - stream: - type: boolean - description: Indicates if the server should stream the response as it's generated - default: false - stop: - type: array - items: - type: string - maxItems: 4 - description: Up to 4 sequences where the API will stop generating further tokens. - default: [] - seed: - type: integer - format: int16 - minimum: -1 - maximum: 1000 - description: If specified, the system will make a best effort to sample deterministically for that particular seed value - max_tokens: - type: integer - format: uint32 - minimum: 1 - description: The maximum number of tokens to generate in the chat completion - logit_bias: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.logit_bias' - description: Modify the likelihood of specified tokens appearing in the completion - response_format: - anyOf: - - $ref: '#/components/schemas/Chat.SimpleCompletionResponseFormat' - - $ref: '#/components/schemas/Chat.SchemaCompletionResponseFormat' - description: Response format (set to `json_object` to restrict output to JSON) - agent: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Agent ID of the agent to use for this interaction. (Only applicable for multi-agent sessions) - allOf: - - $ref: '#/components/schemas/Chat.DefaultChatSettings' - Chat.ChunkChatResponse: - type: object - required: - - choices - properties: - choices: - type: array - items: - $ref: '#/components/schemas/Chat.ChatOutputChunk' - description: The deltas generated by the model - allOf: - - $ref: '#/components/schemas/Chat.BaseChatResponse' - Chat.CompetionUsage: - type: object - properties: - completion_tokens: - type: integer - format: uint32 - description: Number of tokens in the generated completion - readOnly: true - prompt_tokens: - type: integer - format: uint32 - description: Number of tokens in the prompt - readOnly: true - total_tokens: - type: integer - format: uint32 - description: Total number of tokens used in the request (prompt + completion) - readOnly: true - description: Usage statistics for the completion request - Chat.DefaultChatSettings: - type: object - properties: - repetition_penalty: - type: number - format: float - minimum: 0 - maximum: 2 - description: Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - length_penalty: - type: number - format: float - minimum: 0 - maximum: 2 - description: Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize number of tokens generated. - min_p: - type: number - format: float - minimum: 0 - maximum: 1 - description: Minimum probability compared to leading token to be considered - allOf: - - $ref: '#/components/schemas/Chat.OpenAISettings' - description: Default settings for the chat session (also used by the agent) - Chat.FinishReason: - type: string - enum: - - stop - - length - - content_filter - - tool_calls - description: |- - The reason the model stopped generating tokens. This will be `stop` - if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request - was reached, `content_filter` if content was omitted due to a flag - from our content filters, `tool_calls` if the model called a tool. - Chat.LogProbResponse: - type: object - required: - - content - properties: - content: - type: array - items: - $ref: '#/components/schemas/Chat.TokenLogProb' - nullable: true - description: The log probabilities of the tokens - Chat.MessageChatResponse: - type: object - required: - - choices - properties: - choices: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Chat.SingleChatOutput' - - $ref: '#/components/schemas/Chat.MultipleChatOutput' - description: The deltas generated by the model - allOf: - - $ref: '#/components/schemas/Chat.BaseChatResponse' - Chat.MultipleChatOutput: - type: object - required: - - messages - properties: - messages: - type: array - items: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - tool_calls: - type: array - items: - $ref: '#/components/schemas/Tools.ChosenToolCall' - nullable: true - description: Tool calls generated by the model. - default: [] - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - minItems: 1 - readOnly: true - allOf: - - $ref: '#/components/schemas/Chat.BaseChatOutput' - description: The output returned by the model. Note that, depending on the model provider, they might return more than one message. - Chat.OpenAISettings: - type: object - properties: - frequency_penalty: - type: number - format: float - minimum: -2 - maximum: 2 - description: Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - presence_penalty: - type: number - format: float - minimum: -2 - maximum: 2 - description: Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - temperature: - type: number - format: float - minimum: 0 - maximum: 5 - description: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - top_p: - type: number - format: float - minimum: 0 - maximum: 1 - description: Defaults to 1 An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. - Chat.SchemaCompletionResponseFormat: - type: object - required: - - type - - json_schema - properties: - type: - type: string - enum: - - json_schema - description: The format of the response - default: json_schema - json_schema: - type: object - additionalProperties: {} - description: The schema of the response - Chat.SimpleCompletionResponseFormat: - type: object - required: - - type - properties: - type: - type: string - enum: - - text - - json_object - description: The format of the response - default: text - Chat.SingleChatOutput: - type: object - required: - - message - properties: - message: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - tool_calls: - type: array - items: - $ref: '#/components/schemas/Tools.ChosenToolCall' - nullable: true - description: Tool calls generated by the model. - default: [] - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - allOf: - - $ref: '#/components/schemas/Chat.BaseChatOutput' - description: The output returned by the model. Note that, depending on the model provider, they might return more than one message. - Chat.TokenLogProb: - type: object - required: - - top_logprobs - properties: - top_logprobs: - type: array - items: - $ref: '#/components/schemas/Chat.BaseTokenLogProb' - minItems: 1 - description: The log probabilities of the tokens - readOnly: true - allOf: - - $ref: '#/components/schemas/Chat.BaseTokenLogProb' - Common.JinjaTemplate: - type: string - description: A valid jinja template. - Common.PyExpression: - type: string - description: A simple python expression compatible with SimpleEval. - Common.ResourceCreatedResponse: - type: object - required: - - id - - created_at - - jobs - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: ID of created resource - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - jobs: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - description: IDs (if any) of jobs created as part of this request - default: [] - readOnly: true - Common.ResourceDeletedResponse: - type: object - required: - - id - - deleted_at - - jobs - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: ID of deleted resource - deleted_at: - type: string - format: date-time - description: When this resource was deleted as UTC date-time - readOnly: true - jobs: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - description: IDs (if any) of jobs created as part of this request - default: [] - readOnly: true - Common.ResourceUpdatedResponse: - type: object - required: - - id - - updated_at - - jobs - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: ID of updated resource - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - jobs: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - description: IDs (if any) of jobs created as part of this request - default: [] - readOnly: true - Common.identifierSafeUnicode: - type: string - maxLength: 120 - pattern: ^[\p{L}\p{Nl}\p{Pattern_Syntax}\p{Pattern_White_Space}]+[\p{ID_Start}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\p{Pattern_Syntax}\p{Pattern_White_Space}]*$ - description: |- - For Unicode character safety - See: https://unicode.org/reports/tr31/ - See: https://www.unicode.org/reports/tr39/#Identifier_Characters - Common.limit: - type: integer - format: uint16 - minimum: 1 - maximum: 1000 - exclusiveMaximum: true - description: Limit the number of results - Common.logit_bias: - type: number - format: float - minimum: -100 - maximum: 100 - Common.offset: - type: integer - format: uint32 - minimum: 0 - description: Offset to apply to the results - Common.uuid: - type: string - format: uuid - Common.validPythonIdentifier: - type: string - maxLength: 40 - pattern: ^[^\W0-9]\w*$ - description: Valid python identifier names - Docs.BaseDocSearchRequest: - type: object - required: - - limit - - lang - properties: - limit: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - default: 10 - lang: - type: string - enum: - - en-US - description: The language to be used for text-only search. Support for other languages coming soon. - default: en-US - Docs.CreateDocRequest: - type: object - required: - - title - - content - - embed_instruction - properties: - metadata: - type: object - additionalProperties: {} - title: - type: string - maxLength: 800 - description: Title describing what this document contains - content: - anyOf: - - type: string - - type: array - items: - type: string - description: Contents of the document - embed_instruction: - type: string - nullable: true - description: Instruction for the embedding model. - default: null - description: Payload for creating a doc - Docs.Doc: - type: object - required: - - id - - created_at - - title - - content - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - metadata: - type: object - additionalProperties: {} - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - title: - type: string - maxLength: 800 - description: Title describing what this document contains - content: - anyOf: - - type: string - - type: array - items: - type: string - description: Contents of the document - embeddings: - anyOf: - - type: array - items: - type: number - format: float - - type: array - items: - type: array - items: - type: number - format: float - description: Embeddings for the document - readOnly: true - Docs.DocOwner: - type: object - required: - - id - - role - properties: - id: - anyOf: - - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - role: - type: string - enum: - - user - - agent - Docs.DocReference: - type: object - required: - - owner - - id - - snippets - - distance - properties: - owner: - allOf: - - $ref: '#/components/schemas/Docs.DocOwner' - description: The owner of this document. - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - description: ID of the document - title: - type: string - snippets: - type: array - items: - $ref: '#/components/schemas/Docs.Snippet' - minItems: 1 - distance: - type: number - nullable: true - default: null - Docs.DocSearchResponse: - type: object - required: - - docs - - time - properties: - docs: - type: array - items: - $ref: '#/components/schemas/Docs.DocReference' - description: The documents that were found - time: - type: number - minimum: 0 - exclusiveMinimum: true - description: The time taken to search in seconds - Docs.EmbedQueryRequest: - type: object - required: - - text - - embed_instruction - properties: - text: - anyOf: - - type: string - - type: array - items: - type: string - description: Text or texts to embed - embed_instruction: - type: string - description: Instruction for the embedding model. - default: '' - Docs.EmbedQueryResponse: - type: object - required: - - vectors - properties: - vectors: - type: array - items: - type: array - items: - type: number - description: The embedded vectors - Docs.HybridDocSearchRequest: - type: object - required: - - confidence - - alpha - - text - - vector - properties: - confidence: - type: number - minimum: 0 - maximum: 1 - description: The confidence cutoff level - default: 0.5 - alpha: - type: number - minimum: 0 - maximum: 1 - description: The weight to apply to BM25 vs Vector search results. 0 => pure BM25; 1 => pure vector; - default: 0.75 - text: - type: string - description: Text to use in the search. In `hybrid` search mode, either `text` or both `text` and `vector` fields are required. - vector: - type: array - items: - type: number - description: Vector to use in the search. Must be the same dimensions as the embedding model or else an error will be thrown. - allOf: - - $ref: '#/components/schemas/Docs.BaseDocSearchRequest' - Docs.Snippet: - type: object - required: - - index - - content - properties: - index: - type: integer - format: uint16 - content: - type: string - Docs.TextOnlyDocSearchRequest: - type: object - required: - - text - properties: - text: - type: string - description: Text to use in the search. - allOf: - - $ref: '#/components/schemas/Docs.BaseDocSearchRequest' - Docs.VectorDocSearchRequest: - type: object - required: - - confidence - - vector - properties: - confidence: - type: number - minimum: 0 - maximum: 1 - description: The confidence cutoff level - default: 0.5 - vector: - type: array - items: - type: number - description: Vector to use in the search. Must be the same dimensions as the embedding model or else an error will be thrown. - allOf: - - $ref: '#/components/schemas/Docs.BaseDocSearchRequest' - Entries.BaseEntry: - type: object - required: - - role - - name - - content - - source - - tokenizer - - token_count - - timestamp - properties: - role: - $ref: '#/components/schemas/Entries.ChatMLRole' - name: - type: string - nullable: true - default: null - content: - anyOf: - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - - $ref: '#/components/schemas/Tools.Tool' - - $ref: '#/components/schemas/Tools.ChosenToolCall' - - type: string - - $ref: '#/components/schemas/Tools.ToolResponse' - - type: array - items: - anyOf: - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - type: string - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - - $ref: '#/components/schemas/Tools.Tool' - - $ref: '#/components/schemas/Tools.ChosenToolCall' - - type: string - - $ref: '#/components/schemas/Tools.ToolResponse' - source: - type: string - enum: - - api_request - - api_response - - tool_response - - internal - - summarizer - - meta - tokenizer: - type: string - token_count: - type: integer - format: uint16 - timestamp: - type: number - minimum: 0 - description: This is the time that this event refers to. - Entries.ChatMLRole: - type: string - enum: - - user - - assistant - - system - - function - - function_response - - function_call - - auto - description: ChatML role (system|assistant|user|function_call|function|function_response|auto) - Entries.Entry: - type: object - required: - - created_at - - id - properties: - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - allOf: - - $ref: '#/components/schemas/Entries.BaseEntry' - Entries.History: - type: object - required: - - entries - - relations - - session_id - - created_at - properties: - entries: - type: array - items: - $ref: '#/components/schemas/Entries.Entry' - relations: - type: array - items: - $ref: '#/components/schemas/Entries.Relation' - session_id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - Entries.ImageDetail: - type: string - enum: - - low - - high - - auto - description: Image detail level - Entries.Relation: - type: object - required: - - head - - relation - - tail - properties: - head: - $ref: '#/components/schemas/Common.uuid' - relation: - type: string - tail: - $ref: '#/components/schemas/Common.uuid' - Executions.CreateExecutionRequest: - type: object - required: - - input - properties: - input: - type: object - additionalProperties: {} - description: The input to the execution - output: - description: The output of the execution if it succeeded - error: - type: string - description: The error of the execution if it failed - metadata: - type: object - additionalProperties: {} - description: Payload for creating an execution - Executions.Execution: - type: object - required: - - task_id - - status - - input - - created_at - - updated_at - - id - properties: - task_id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - description: The ID of the task that the execution is running - status: - type: string - enum: - - queued - - starting - - running - - awaiting_input - - succeeded - - failed - - cancelled - description: The status of the execution - readOnly: true - input: - type: object - additionalProperties: {} - description: The input to the execution - output: - description: The output of the execution if it succeeded - error: - type: string - description: The error of the execution if it failed - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - metadata: - type: object - additionalProperties: {} - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - Executions.ResumeExecutionRequest: - type: object - required: - - status - properties: - status: - type: string - enum: - - running - default: running - input: - type: object - additionalProperties: {} - description: The input to resume the execution with - allOf: - - $ref: '#/components/schemas/Executions.UpdateExecutionRequest' - Executions.StopExecutionRequest: - type: object - required: - - status - - reason - properties: - status: - type: string - enum: - - cancelled - default: cancelled - reason: - type: string - nullable: true - description: The reason for stopping the execution - default: null - allOf: - - $ref: '#/components/schemas/Executions.UpdateExecutionRequest' - Executions.TaskTokenResumeExecutionRequest: - type: object - required: - - status - properties: - status: - type: string - enum: - - running - default: running - input: - type: object - additionalProperties: {} - description: The input to resume the execution with - Executions.Transition: - type: object - required: - - execution_id - - current - - next - - id - properties: - execution_id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - current: - allOf: - - $ref: '#/components/schemas/Executions.TransitionTarget' - readOnly: true - next: - type: object - allOf: - - $ref: '#/components/schemas/Executions.TransitionTarget' - nullable: true - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - metadata: - type: object - additionalProperties: {} - allOf: - - $ref: '#/components/schemas/Executions.TransitionEvent' - Executions.TransitionEvent: - type: object - required: - - type - - output - - created_at - - updated_at - properties: - type: - type: string - enum: - - init - - init_branch - - finish - - finish_branch - - wait - - resume - - error - - step - - cancelled - readOnly: true - output: - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - Executions.TransitionTarget: - type: object - required: - - workflow - - step - properties: - workflow: - $ref: '#/components/schemas/Common.identifierSafeUnicode' - step: - type: integer - format: uint16 - Executions.UpdateExecutionRequest: - type: object - required: - - status - properties: - status: - type: string - enum: - - queued - - starting - - running - - awaiting_input - - succeeded - - failed - - cancelled - discriminator: - propertyName: status - mapping: - cancelled: '#/components/schemas/Executions.StopExecutionRequest' - running: '#/components/schemas/Executions.ResumeExecutionRequest' - Jobs.JobState: - type: string - enum: - - pending - - in_progress - - retrying - - succeeded - - aborted - - failed - - unknown - description: 'Current state (one of: pending, in_progress, retrying, succeeded, aborted, failed)' - Jobs.JobStatus: - type: object - required: - - id - - created_at - - updated_at - - name - - reason - - has_progress - - progress - - state - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the job - default: '' - reason: - type: string - description: Reason for the current state of the job - default: '' - has_progress: - type: boolean - description: Whether this Job supports progress updates - default: false - progress: - type: number - format: float - minimum: 0 - maximum: 100 - description: Progress percentage - default: 0 - state: - allOf: - - $ref: '#/components/schemas/Jobs.JobState' - description: Current state of the job - default: pending - Sessions.ContextOverflowType: - type: string - enum: - - truncate - - adaptive - Sessions.CreateOrUpdateSessionRequest: - type: object - required: - - id - - situation - - render_templates - - token_budget - - context_overflow - - forward_tool_results - properties: - id: - $ref: '#/components/schemas/Common.uuid' - user: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: User ID of user associated with this session - users: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - agent: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Agent ID of agent associated with this session - agents: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - situation: - type: string - description: A specific situation that sets the background for this session - default: |- - {%- if agent.name -%} - You are {{agent.name}}.{{" "}} - {%- endif -%} - - {%- if agent.about -%} - About you: {{agent.about}}.{{" "}} - {%- endif -%} - - {%- if user -%} - You are talking to a user - {%- if user.name -%}{{" "}} and their name is {{user.name}} - {%- if user.about -%}. About the user: {{user.about}}.{%- else -%}.{%- endif -%} - {%- endif -%} - {%- endif -%} - - {{" - - "}} - - {%- if agent.instructions -%} - Instructions:{{" - "}} - {%- if agent.instructions is string -%} - {{agent.instructions}}{{" - "}} - {%- else -%} - {%- for instruction in agent.instructions -%} - - {{instruction}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{" - "}} - {%- endif -%} - - {%- if tools -%} - Tools:{{" - "}} - {%- for tool in tools -%} - {%- if tool.type == "function" -%} - - {{tool.function.name}} - {%- if tool.function.description -%}: {{tool.function.description}}{%- endif -%}{{" - "}} - {%- else -%} - - {{ 0/0 }} {# Error: Other tool types aren't supported yet. #} - {%- endif -%} - {%- endfor -%} - {{" - - "}} - {%- endif -%} - - {%- if docs -%} - Relevant documents:{{" - "}} - {%- for doc in docs -%} - {{doc.title}}{{" - "}} - {%- if doc.content is string -%} - {{doc.content}}{{" - "}} - {%- else -%} - {%- for snippet in doc.content -%} - {{snippet}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{"---"}} - {%- endfor -%} - {%- endif -%} - render_templates: - type: boolean - description: Render system and assistant message content as jinja templates - default: true - token_budget: - type: integer - format: uint16 - nullable: true - description: Threshold value for the adaptive context functionality - default: null - context_overflow: - oneOf: - - $ref: '#/components/schemas/Sessions.ContextOverflowType' - nullable: true - description: Action to start on context window overflow - default: null - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be sent back to the model as the model's input. - If a tool call is not made, the model's output will be returned as is. - default: null - metadata: - type: object - additionalProperties: {} - allOf: - - $ref: '#/components/schemas/Sessions.CreateSessionRequest' - Sessions.CreateSessionRequest: - type: object - required: - - situation - - render_templates - - token_budget - - context_overflow - - forward_tool_results - properties: - user: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: User ID of user associated with this session - users: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - agent: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Agent ID of agent associated with this session - agents: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - situation: - type: string - description: A specific situation that sets the background for this session - default: |- - {%- if agent.name -%} - You are {{agent.name}}.{{" "}} - {%- endif -%} - - {%- if agent.about -%} - About you: {{agent.about}}.{{" "}} - {%- endif -%} - - {%- if user -%} - You are talking to a user - {%- if user.name -%}{{" "}} and their name is {{user.name}} - {%- if user.about -%}. About the user: {{user.about}}.{%- else -%}.{%- endif -%} - {%- endif -%} - {%- endif -%} - - {{" - - "}} - - {%- if agent.instructions -%} - Instructions:{{" - "}} - {%- if agent.instructions is string -%} - {{agent.instructions}}{{" - "}} - {%- else -%} - {%- for instruction in agent.instructions -%} - - {{instruction}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{" - "}} - {%- endif -%} - - {%- if tools -%} - Tools:{{" - "}} - {%- for tool in tools -%} - {%- if tool.type == "function" -%} - - {{tool.function.name}} - {%- if tool.function.description -%}: {{tool.function.description}}{%- endif -%}{{" - "}} - {%- else -%} - - {{ 0/0 }} {# Error: Other tool types aren't supported yet. #} - {%- endif -%} - {%- endfor -%} - {{" - - "}} - {%- endif -%} - - {%- if docs -%} - Relevant documents:{{" - "}} - {%- for doc in docs -%} - {{doc.title}}{{" - "}} - {%- if doc.content is string -%} - {{doc.content}}{{" - "}} - {%- else -%} - {%- for snippet in doc.content -%} - {{snippet}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{"---"}} - {%- endfor -%} - {%- endif -%} - render_templates: - type: boolean - description: Render system and assistant message content as jinja templates - default: true - token_budget: - type: integer - format: uint16 - nullable: true - description: Threshold value for the adaptive context functionality - default: null - context_overflow: - oneOf: - - $ref: '#/components/schemas/Sessions.ContextOverflowType' - nullable: true - description: Action to start on context window overflow - default: null - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be sent back to the model as the model's input. - If a tool call is not made, the model's output will be returned as is. - default: null - metadata: - type: object - additionalProperties: {} - description: Payload for creating a session - Sessions.MultiAgentMultiUserSession: - type: object - required: - - agents - - users - properties: - agents: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - minItems: 2 - users: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - minItems: 2 - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.MultiAgentNoUserSession: - type: object - required: - - agents - properties: - agents: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - minItems: 2 - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.MultiAgentSingleUserSession: - type: object - required: - - agents - - user - properties: - agents: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - minItems: 2 - user: - $ref: '#/components/schemas/Common.uuid' - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.PatchSessionRequest: - type: object - properties: - situation: - type: string - description: A specific situation that sets the background for this session - default: |- - {%- if agent.name -%} - You are {{agent.name}}.{{" "}} - {%- endif -%} - - {%- if agent.about -%} - About you: {{agent.about}}.{{" "}} - {%- endif -%} - - {%- if user -%} - You are talking to a user - {%- if user.name -%}{{" "}} and their name is {{user.name}} - {%- if user.about -%}. About the user: {{user.about}}.{%- else -%}.{%- endif -%} - {%- endif -%} - {%- endif -%} - - {{" - - "}} - - {%- if agent.instructions -%} - Instructions:{{" - "}} - {%- if agent.instructions is string -%} - {{agent.instructions}}{{" - "}} - {%- else -%} - {%- for instruction in agent.instructions -%} - - {{instruction}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{" - "}} - {%- endif -%} - - {%- if tools -%} - Tools:{{" - "}} - {%- for tool in tools -%} - {%- if tool.type == "function" -%} - - {{tool.function.name}} - {%- if tool.function.description -%}: {{tool.function.description}}{%- endif -%}{{" - "}} - {%- else -%} - - {{ 0/0 }} {# Error: Other tool types aren't supported yet. #} - {%- endif -%} - {%- endfor -%} - {{" - - "}} - {%- endif -%} - - {%- if docs -%} - Relevant documents:{{" - "}} - {%- for doc in docs -%} - {{doc.title}}{{" - "}} - {%- if doc.content is string -%} - {{doc.content}}{{" - "}} - {%- else -%} - {%- for snippet in doc.content -%} - {{snippet}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{"---"}} - {%- endfor -%} - {%- endif -%} - render_templates: - type: boolean - description: Render system and assistant message content as jinja templates - default: true - token_budget: - type: integer - format: uint16 - nullable: true - description: Threshold value for the adaptive context functionality - default: null - context_overflow: - oneOf: - - $ref: '#/components/schemas/Sessions.ContextOverflowType' - nullable: true - description: Action to start on context window overflow - default: null - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be sent back to the model as the model's input. - If a tool call is not made, the model's output will be returned as is. - default: null - metadata: - type: object - additionalProperties: {} - description: Payload for patching a session - Sessions.Session: - type: object - required: - - situation - - summary - - render_templates - - token_budget - - context_overflow - - forward_tool_results - - id - - created_at - - updated_at - properties: - situation: - type: string - description: A specific situation that sets the background for this session - default: |- - {%- if agent.name -%} - You are {{agent.name}}.{{" "}} - {%- endif -%} - - {%- if agent.about -%} - About you: {{agent.about}}.{{" "}} - {%- endif -%} - - {%- if user -%} - You are talking to a user - {%- if user.name -%}{{" "}} and their name is {{user.name}} - {%- if user.about -%}. About the user: {{user.about}}.{%- else -%}.{%- endif -%} - {%- endif -%} - {%- endif -%} - - {{" - - "}} - - {%- if agent.instructions -%} - Instructions:{{" - "}} - {%- if agent.instructions is string -%} - {{agent.instructions}}{{" - "}} - {%- else -%} - {%- for instruction in agent.instructions -%} - - {{instruction}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{" - "}} - {%- endif -%} - - {%- if tools -%} - Tools:{{" - "}} - {%- for tool in tools -%} - {%- if tool.type == "function" -%} - - {{tool.function.name}} - {%- if tool.function.description -%}: {{tool.function.description}}{%- endif -%}{{" - "}} - {%- else -%} - - {{ 0/0 }} {# Error: Other tool types aren't supported yet. #} - {%- endif -%} - {%- endfor -%} - {{" - - "}} - {%- endif -%} - - {%- if docs -%} - Relevant documents:{{" - "}} - {%- for doc in docs -%} - {{doc.title}}{{" - "}} - {%- if doc.content is string -%} - {{doc.content}}{{" - "}} - {%- else -%} - {%- for snippet in doc.content -%} - {{snippet}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{"---"}} - {%- endfor -%} - {%- endif -%} - summary: - type: string - nullable: true - description: Summary (null at the beginning) - generated automatically after every interaction - default: null - readOnly: true - render_templates: - type: boolean - description: Render system and assistant message content as jinja templates - default: true - token_budget: - type: integer - format: uint16 - nullable: true - description: Threshold value for the adaptive context functionality - default: null - context_overflow: - oneOf: - - $ref: '#/components/schemas/Sessions.ContextOverflowType' - nullable: true - description: Action to start on context window overflow - default: null - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be sent back to the model as the model's input. - If a tool call is not made, the model's output will be returned as is. - default: null - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - metadata: - type: object - additionalProperties: {} - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - kind: - type: string - description: Discriminator property for Session. - discriminator: - propertyName: kind - mapping: - single_agent_no_user: '#/components/schemas/Sessions.SingleAgentNoUserSession' - single_agent_single_user: '#/components/schemas/Sessions.SingleAgentSingleUserSession' - single_agent_multi_user: '#/components/schemas/Sessions.SingleAgentMultiUserSession' - multi_agent_no_user: '#/components/schemas/Sessions.MultiAgentNoUserSession' - multi_agent_single_user: '#/components/schemas/Sessions.MultiAgentSingleUserSession' - multi_agent_multi_user: '#/components/schemas/Sessions.MultiAgentMultiUserSession' - Sessions.SingleAgentMultiUserSession: - type: object - required: - - agent - - users - properties: - agent: - $ref: '#/components/schemas/Common.uuid' - users: - type: array - items: - $ref: '#/components/schemas/Common.uuid' - minItems: 2 - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.SingleAgentNoUserSession: - type: object - required: - - agent - properties: - agent: - $ref: '#/components/schemas/Common.uuid' - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.SingleAgentSingleUserSession: - type: object - required: - - agent - - user - properties: - agent: - $ref: '#/components/schemas/Common.uuid' - user: - $ref: '#/components/schemas/Common.uuid' - allOf: - - $ref: '#/components/schemas/Sessions.Session' - Sessions.UpdateSessionRequest: - type: object - required: - - situation - - render_templates - - token_budget - - context_overflow - - forward_tool_results - properties: - situation: - type: string - description: A specific situation that sets the background for this session - default: |- - {%- if agent.name -%} - You are {{agent.name}}.{{" "}} - {%- endif -%} - - {%- if agent.about -%} - About you: {{agent.about}}.{{" "}} - {%- endif -%} - - {%- if user -%} - You are talking to a user - {%- if user.name -%}{{" "}} and their name is {{user.name}} - {%- if user.about -%}. About the user: {{user.about}}.{%- else -%}.{%- endif -%} - {%- endif -%} - {%- endif -%} - - {{" - - "}} - - {%- if agent.instructions -%} - Instructions:{{" - "}} - {%- if agent.instructions is string -%} - {{agent.instructions}}{{" - "}} - {%- else -%} - {%- for instruction in agent.instructions -%} - - {{instruction}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{" - "}} - {%- endif -%} - - {%- if tools -%} - Tools:{{" - "}} - {%- for tool in tools -%} - {%- if tool.type == "function" -%} - - {{tool.function.name}} - {%- if tool.function.description -%}: {{tool.function.description}}{%- endif -%}{{" - "}} - {%- else -%} - - {{ 0/0 }} {# Error: Other tool types aren't supported yet. #} - {%- endif -%} - {%- endfor -%} - {{" - - "}} - {%- endif -%} - - {%- if docs -%} - Relevant documents:{{" - "}} - {%- for doc in docs -%} - {{doc.title}}{{" - "}} - {%- if doc.content is string -%} - {{doc.content}}{{" - "}} - {%- else -%} - {%- for snippet in doc.content -%} - {{snippet}}{{" - "}} - {%- endfor -%} - {%- endif -%} - {{"---"}} - {%- endfor -%} - {%- endif -%} - render_templates: - type: boolean - description: Render system and assistant message content as jinja templates - default: true - token_budget: - type: integer - format: uint16 - nullable: true - description: Threshold value for the adaptive context functionality - default: null - context_overflow: - oneOf: - - $ref: '#/components/schemas/Sessions.ContextOverflowType' - nullable: true - description: Action to start on context window overflow - default: null - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be sent back to the model as the model's input. - If a tool call is not made, the model's output will be returned as is. - default: null - metadata: - type: object - additionalProperties: {} - description: Payload for updating a session - Tasks.CaseThen: - type: object - required: - - case - - then - properties: - case: - anyOf: - - $ref: '#/components/schemas/Common.PyExpression' - - type: string - enum: - - _ - description: The condition to evaluate - then: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - description: The steps to run if the condition is true - Tasks.CaseThenUpdateItem: - type: object - required: - - case - - then - properties: - case: - anyOf: - - $ref: '#/components/schemas/Common.PyExpression' - - type: string - enum: - - _ - description: The condition to evaluate - then: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - description: The steps to run if the condition is true - Tasks.CreateTaskRequest: - type: object - required: - - name - - description - - main - - input_schema - - tools - - inherit_tools - properties: - name: - type: string - description: - type: string - default: '' - main: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - minItems: 1 - description: The entrypoint of the task. - input_schema: - type: object - additionalProperties: {} - nullable: true - description: The schema for the input to the task. `null` means all inputs are valid. - default: null - tools: - type: array - items: - $ref: '#/components/schemas/Tasks.TaskTool' - description: Tools defined specifically for this task not included in the Agent itself. - default: [] - inherit_tools: - type: boolean - description: Whether to inherit tools from the parent agent or not. Defaults to true. - default: true - metadata: - type: object - additionalProperties: {} - additionalProperties: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - description: Payload for creating a task - Tasks.ErrorWorkflowStep: - type: object - required: - - kind_ - - error - properties: - kind_: - type: string - enum: - - error - default: error - readOnly: true - error: - type: string - description: The error message - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - error - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.EvaluateStep: - type: object - required: - - kind_ - - evaluate - properties: - kind_: - type: string - enum: - - evaluate - default: evaluate - readOnly: true - evaluate: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - description: The expression to evaluate - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - evaluate - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ForeachDo: - type: object - required: - - in - - do - properties: - in: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The variable to iterate over. - VALIDATION: Should NOT return more than 1000 elements. - do: - anyOf: - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - Tasks.ForeachDoUpdateItem: - type: object - required: - - in - - do - properties: - in: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The variable to iterate over. - VALIDATION: Should NOT return more than 1000 elements. - do: - anyOf: - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - Tasks.ForeachStep: - type: object - required: - - kind_ - - foreach - properties: - kind_: - type: string - enum: - - foreach - default: foreach - readOnly: true - foreach: - allOf: - - $ref: '#/components/schemas/Tasks.ForeachDo' - description: The steps to run for each iteration - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - foreach - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ForeachStepUpdateItem: - type: object - required: - - foreach - properties: - foreach: - allOf: - - $ref: '#/components/schemas/Tasks.ForeachDoUpdateItem' - description: The steps to run for each iteration - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - mapping: {} - Tasks.GetStep: - type: object - required: - - kind_ - - get - properties: - kind_: - type: string - enum: - - get - default: get - readOnly: true - get: - type: string - description: The key to get - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - get - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.IfElseWorkflowStep: - type: object - required: - - kind_ - - if - - then - - else - properties: - kind_: - type: string - enum: - - if_else - default: if_else - readOnly: true - if: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The condition to evaluate - then: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - description: The steps to run if the condition is true - else: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - nullable: true - description: The steps to run if the condition is false - default: null - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - if_else - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.IfElseWorkflowStepUpdateItem: - type: object - required: - - if - - then - - else - properties: - if: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The condition to evaluate - then: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - description: The steps to run if the condition is true - else: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - nullable: true - description: The steps to run if the condition is false - default: null - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - mapping: {} - Tasks.LogStep: - type: object - required: - - kind_ - - log - properties: - kind_: - type: string - enum: - - log - default: log - readOnly: true - log: - allOf: - - $ref: '#/components/schemas/Common.JinjaTemplate' - description: The value to log - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - log - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ParallelStep: - type: object - required: - - kind_ - - parallel - properties: - kind_: - type: string - enum: - - parallel - default: parallel - readOnly: true - parallel: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - maxItems: 100 - description: The steps to run in parallel. Max concurrency will depend on the platform. - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - parallel - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ParallelStepUpdateItem: - type: object - required: - - parallel - properties: - parallel: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - maxItems: 100 - description: The steps to run in parallel. Max concurrency will depend on the platform. - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - mapping: {} - Tasks.PatchTaskRequest: - type: object - properties: - description: - type: string - default: '' - main: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStepUpdateItem' - - $ref: '#/components/schemas/Tasks.SwitchStepUpdateItem' - - $ref: '#/components/schemas/Tasks.ForeachStepUpdateItem' - - $ref: '#/components/schemas/Tasks.ParallelStepUpdateItem' - - type: object - required: - - over - - map - properties: - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - minItems: 1 - description: The entrypoint of the task. - input_schema: - type: object - additionalProperties: {} - nullable: true - description: The schema for the input to the task. `null` means all inputs are valid. - default: null - tools: - type: array - items: - $ref: '#/components/schemas/Tasks.TaskTool' - description: Tools defined specifically for this task not included in the Agent itself. - default: [] - inherit_tools: - type: boolean - description: Whether to inherit tools from the parent agent or not. Defaults to true. - default: true - metadata: - type: object - additionalProperties: {} - additionalProperties: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStepUpdateItem' - - $ref: '#/components/schemas/Tasks.SwitchStepUpdateItem' - - $ref: '#/components/schemas/Tasks.ForeachStepUpdateItem' - - $ref: '#/components/schemas/Tasks.ParallelStepUpdateItem' - - type: object - required: - - over - - map - properties: - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStepUpdateItem' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - description: Payload for patching a task - Tasks.PromptStep: - type: object - required: - - kind_ - - prompt - - tools - - forward_tool_results - properties: - kind_: - type: string - enum: - - prompt - default: prompt - readOnly: true - prompt: - anyOf: - - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - $ref: '#/components/schemas/Common.JinjaTemplate' - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - continue: - type: boolean - description: Whether to continue this message or return a new one - description: The prompt to run - tools: - anyOf: - - type: string - enum: - - all - - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.ToolRef' - - $ref: '#/components/schemas/Tools.CreateToolRequest' - description: The tools to use for the prompt - default: [] - tool_choice: - anyOf: - - type: string - enum: - - auto - - none - - $ref: '#/components/schemas/Tools.NamedToolChoice' - description: The tool choice for the prompt - settings: - allOf: - - $ref: '#/components/schemas/Chat.ChatSettings' - description: Settings for the prompt - unwrap: - type: boolean - description: Whether to unwrap the output of the prompt step, equivalent to `response.choices[0].message.content` - default: false - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be used as the model's input. - If a tool call is not made, the model's output will be used as the next step's input. - default: null - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - prompt - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.PromptStepUpdateItem: - type: object - required: - - prompt - - tools - - forward_tool_results - properties: - prompt: - anyOf: - - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/Entries.ChatMLRole' - description: The role of the message - content: - anyOf: - - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - $ref: '#/components/schemas/Common.JinjaTemplate' - - type: array - items: - anyOf: - - type: object - required: - - text - - type - properties: - text: - $ref: '#/components/schemas/Common.JinjaTemplate' - type: - type: string - enum: - - text - description: The type (fixed to 'text') - default: text - - type: object - required: - - image_url - - type - properties: - image_url: - type: object - required: - - url - - detail - properties: - url: - type: string - description: Image URL or base64 data url (e.g. `data:image/jpeg;base64,`) - detail: - allOf: - - $ref: '#/components/schemas/Entries.ImageDetail' - description: The detail level of the image - default: auto - description: The image URL - type: - type: string - enum: - - image_url - description: The type (fixed to 'image_url') - default: image_url - description: The content parts of the message - name: - type: string - description: Name - continue: - type: boolean - description: Whether to continue this message or return a new one - description: The prompt to run - tools: - anyOf: - - type: string - enum: - - all - - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.ToolRefUpdateItem' - - $ref: '#/components/schemas/Tools.CreateToolRequest' - description: The tools to use for the prompt - default: [] - tool_choice: - anyOf: - - type: string - enum: - - auto - - none - - $ref: '#/components/schemas/Tools.NamedToolChoice' - description: The tool choice for the prompt - settings: - allOf: - - $ref: '#/components/schemas/Chat.ChatSettings' - description: Settings for the prompt - unwrap: - type: boolean - description: Whether to unwrap the output of the prompt step, equivalent to `response.choices[0].message.content` - default: false - forward_tool_results: - type: boolean - nullable: true - description: |- - Whether to forward the tool results to the model when available. - "true" => always forward - "false" => never forward - null => forward if applicable (default) - - If a tool call is made, the tool's output will be used as the model's input. - If a tool call is not made, the model's output will be used as the next step's input. - default: null - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ReturnStep: - type: object - required: - - kind_ - - return - properties: - kind_: - type: string - enum: - - return - default: return - readOnly: true - return: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - description: The value to return - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - return - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.SetStep: - type: object - required: - - kind_ - - set - properties: - kind_: - type: string - enum: - - set - default: set - readOnly: true - set: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - description: The value to set - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - set - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.SleepFor: - type: object - required: - - seconds - - minutes - - hours - - days - properties: - seconds: - type: integer - format: uint16 - minimum: 0 - maximum: 60 - description: The number of seconds to sleep for - default: 0 - minutes: - type: integer - format: uint16 - minimum: 0 - maximum: 60 - description: The number of minutes to sleep for - default: 0 - hours: - type: integer - format: uint16 - minimum: 0 - maximum: 24 - description: The number of hours to sleep for - default: 0 - days: - type: integer - format: uint16 - minimum: 0 - maximum: 30 - description: The number of days to sleep for - default: 0 - Tasks.SleepStep: - type: object - required: - - kind_ - - sleep - properties: - kind_: - type: string - enum: - - sleep - default: sleep - readOnly: true - sleep: - allOf: - - $ref: '#/components/schemas/Tasks.SleepFor' - description: The duration to sleep for (max 31 days) - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - sleep - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.SwitchStep: - type: object - required: - - kind_ - - switch - properties: - kind_: - type: string - enum: - - switch - default: switch - readOnly: true - switch: - type: array - items: - $ref: '#/components/schemas/Tasks.CaseThen' - minItems: 1 - description: The cond tree - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - switch - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.SwitchStepUpdateItem: - type: object - required: - - switch - properties: - switch: - type: array - items: - $ref: '#/components/schemas/Tasks.CaseThenUpdateItem' - minItems: 1 - description: The cond tree - allOf: - - type: object - properties: - kind_: - type: string - description: Discriminator property for BaseWorkflowStep. - discriminator: - propertyName: kind_ - mapping: {} - Tasks.Task: - type: object - required: - - name - - description - - main - - input_schema - - tools - - inherit_tools - - id - - created_at - - updated_at - properties: - name: - type: string - description: - type: string - default: '' - main: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - minItems: 1 - description: The entrypoint of the task. - input_schema: - type: object - additionalProperties: {} - nullable: true - description: The schema for the input to the task. `null` means all inputs are valid. - default: null - tools: - type: array - items: - $ref: '#/components/schemas/Tasks.TaskTool' - description: Tools defined specifically for this task not included in the Agent itself. - default: [] - inherit_tools: - type: boolean - description: Whether to inherit tools from the parent agent or not. Defaults to true. - default: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - metadata: - type: object - additionalProperties: {} - additionalProperties: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - description: Object describing a Task - Tasks.TaskTool: - type: object - properties: - inherited: - type: boolean - description: 'Read-only: Whether the tool was inherited or not. Only applies within tasks.' - default: false - readOnly: true - allOf: - - $ref: '#/components/schemas/Tools.CreateToolRequest' - Tasks.ToolCallStep: - type: object - required: - - kind_ - - tool - - arguments - properties: - kind_: - type: string - enum: - - tool_call - default: tool_call - readOnly: true - tool: - allOf: - - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: The tool to run - arguments: - anyOf: - - type: object - additionalProperties: - anyOf: - - $ref: '#/components/schemas/Common.PyExpression' - - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - - type: string - enum: - - _ - description: The input parameters for the tool (defaults to last step output) - default: _ - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - tool_call - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.ToolRef: - type: object - required: - - ref - properties: - ref: - anyOf: - - $ref: '#/components/schemas/Tasks.ToolRefById' - - $ref: '#/components/schemas/Tasks.ToolRefByName' - description: Reference to a tool - Tasks.ToolRefById: - type: object - properties: - id: - $ref: '#/components/schemas/Common.uuid' - description: Reference to a tool by id - Tasks.ToolRefByName: - type: object - properties: - name: - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: Reference to a tool by name - Tasks.ToolRefUpdateItem: - type: object - description: Reference to a tool - Tasks.UpdateTaskRequest: - type: object - required: - - description - - main - - input_schema - - tools - - inherit_tools - properties: - description: - type: string - default: '' - main: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - minItems: 1 - description: The entrypoint of the task. - input_schema: - type: object - additionalProperties: {} - nullable: true - description: The schema for the input to the task. `null` means all inputs are valid. - default: null - tools: - type: array - items: - $ref: '#/components/schemas/Tasks.TaskTool' - description: Tools defined specifically for this task not included in the Agent itself. - default: [] - inherit_tools: - type: boolean - description: Whether to inherit tools from the parent agent or not. Defaults to true. - default: true - metadata: - type: object - additionalProperties: {} - additionalProperties: - type: array - items: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - - $ref: '#/components/schemas/Tasks.ReturnStep' - - $ref: '#/components/schemas/Tasks.SleepStep' - - $ref: '#/components/schemas/Tasks.ErrorWorkflowStep' - - $ref: '#/components/schemas/Tasks.WaitForInputStep' - - $ref: '#/components/schemas/Tasks.IfElseWorkflowStep' - - $ref: '#/components/schemas/Tasks.SwitchStep' - - $ref: '#/components/schemas/Tasks.ForeachStep' - - $ref: '#/components/schemas/Tasks.ParallelStep' - - type: object - required: - - kind_ - - over - - map - properties: - kind_: - type: string - enum: - - map_reduce - default: map_reduce - readOnly: true - over: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: The variable to iterate over - map: - anyOf: - - $ref: '#/components/schemas/Tasks.EvaluateStep' - - $ref: '#/components/schemas/Tasks.ToolCallStep' - - $ref: '#/components/schemas/Tasks.PromptStep' - - $ref: '#/components/schemas/Tasks.GetStep' - - $ref: '#/components/schemas/Tasks.SetStep' - - $ref: '#/components/schemas/Tasks.LogStep' - - $ref: '#/components/schemas/Tasks.YieldStep' - description: The steps to run for each iteration - reduce: - allOf: - - $ref: '#/components/schemas/Common.PyExpression' - description: |- - The expression to reduce the results. - If not provided, the results are collected and returned as a list. - A special parameter named `results` is the accumulator and `_` is the current value. - initial: - description: The initial value of the reduce expression - default: [] - parallelism: - type: integer - format: uint16 - minimum: 1 - maximum: 100 - description: Whether to run the reduce expression in parallel and how many items to run in each batch - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - map_reduce - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - description: Payload for updating a task - Tasks.WaitForInputInfo: - type: object - required: - - info - properties: - info: - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - description: Any additional info or data - Tasks.WaitForInputStep: - type: object - required: - - kind_ - - wait_for_input - properties: - kind_: - type: string - enum: - - wait_for_input - default: wait_for_input - readOnly: true - wait_for_input: - allOf: - - $ref: '#/components/schemas/Tasks.WaitForInputInfo' - description: Any additional info or data - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - wait_for_input - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tasks.YieldStep: - type: object - required: - - kind_ - - workflow - - arguments - properties: - kind_: - type: string - enum: - - yield - default: yield - readOnly: true - workflow: - type: string - description: |- - The subworkflow to run. - VALIDATION: Should resolve to a defined subworkflow. - arguments: - anyOf: - - type: object - additionalProperties: - $ref: '#/components/schemas/Common.PyExpression' - - type: string - enum: - - _ - description: The input parameters for the subworkflow (defaults to last step output) - default: _ - allOf: - - type: object - required: - - kind_ - properties: - kind_: - type: string - enum: - - yield - description: The kind of step - readOnly: true - discriminator: - propertyName: kind_ - mapping: {} - Tools.ApiCallDef: - type: object - required: - - method - - url - properties: - method: - type: string - enum: - - GET - - POST - - PUT - - DELETE - - PATCH - - HEAD - - OPTIONS - - CONNECT - - TRACE - description: The HTTP method to use - url: - type: string - format: uri - description: The URL to call - headers: - type: object - additionalProperties: - type: string - description: The headers to send with the request - content: - type: string - description: The content as base64 to send with the request - data: - type: object - additionalProperties: {} - description: The data to send as form data - json: - type: object - additionalProperties: {} - description: JSON body to send with the request - cookies: - type: object - additionalProperties: - type: string - description: Cookies - params: - anyOf: - - type: string - - type: object - additionalProperties: {} - description: The parameters to send with the request - follow_redirects: - type: boolean - description: Follow redirects - timeout: - type: integer - format: uint8 - description: The timeout for the request - description: API call definition - Tools.ApiCallDefUpdate: - type: object - properties: - method: - type: string - enum: - - GET - - POST - - PUT - - DELETE - - PATCH - - HEAD - - OPTIONS - - CONNECT - - TRACE - description: The HTTP method to use - url: - type: string - format: uri - description: The URL to call - headers: - type: object - additionalProperties: - type: string - description: The headers to send with the request - content: - type: string - description: The content as base64 to send with the request - data: - type: object - additionalProperties: {} - description: The data to send as form data - json: - type: object - additionalProperties: {} - description: JSON body to send with the request - cookies: - type: object - additionalProperties: - type: string - description: Cookies - params: - anyOf: - - type: string - - type: object - additionalProperties: {} - description: The parameters to send with the request - follow_redirects: - type: boolean - description: Follow redirects - timeout: - type: integer - format: uint8 - description: The timeout for the request - description: API call definition - Tools.ChosenFunctionCall: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - function: - allOf: - - $ref: '#/components/schemas/Tools.FunctionCallOption' - description: The function to call - allOf: - - $ref: '#/components/schemas/Tools.ChosenToolCall' - Tools.ChosenToolCall: - type: object - required: - - type - - id - properties: - type: - allOf: - - $ref: '#/components/schemas/Tools.ToolType' - description: Whether this tool is a `function`, `api_call`, `system` etc. (Only `function` tool supported right now) - function: - $ref: '#/components/schemas/Tools.FunctionCallOption' - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - discriminator: - propertyName: type - mapping: - function: '#/components/schemas/Tools.ChosenFunctionCall' - description: The response tool value generated by the model - Tools.CreateToolRequest: - type: object - required: - - name - properties: - name: - allOf: - - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: Name of the tool (must be unique for this agent and a valid python identifier string ) - description: - type: string - description: Description of the tool - function: - allOf: - - $ref: '#/components/schemas/Tools.FunctionDef' - description: The function to call - integration: - allOf: - - $ref: '#/components/schemas/Tools.IntegrationDef' - description: The integration to call - system: - allOf: - - $ref: '#/components/schemas/Tools.SystemDef' - description: The system to call - api_call: - allOf: - - $ref: '#/components/schemas/Tools.ApiCallDef' - description: The API call to make - description: Payload for creating a tool - Tools.FunctionCallOption: - type: object - required: - - name - properties: - name: - type: string - description: The name of the function - Tools.FunctionDef: - type: object - properties: - name: - nullable: true - description: 'DO NOT USE: This will be overriden by the tool name. Here only for compatibility reasons.' - default: null - description: - nullable: true - description: 'DO NOT USE: This will be overriden by the tool description. Here only for compatibility reasons.' - default: null - parameters: - type: object - additionalProperties: {} - description: The parameters the function accepts - description: Function definition - Tools.IntegrationDef: - type: object - required: - - provider - properties: - provider: - anyOf: - - type: string - enum: - - dummy - - hacker_news - - weather - - wikipedia - - spider - - brave - - browserbase - - email - - type: string - description: The provider of the integration - method: - type: string - description: The specific method of the integration to call - setup: - type: object - additionalProperties: {} - description: The setup parameters the integration accepts - arguments: - type: object - additionalProperties: {} - description: The arguments to pre-apply to the integration call - description: Integration definition - Tools.IntegrationDefUpdate: - type: object - properties: - provider: - anyOf: - - type: string - enum: - - dummy - - hacker_news - - weather - - wikipedia - - spider - - brave - - browserbase - - email - - type: string - description: The provider of the integration - method: - type: string - description: The specific method of the integration to call - setup: - type: object - additionalProperties: {} - description: The setup parameters the integration accepts - arguments: - type: object - additionalProperties: {} - description: The arguments to pre-apply to the integration call - description: Integration definition - Tools.NamedToolChoice: - type: object - properties: - function: - $ref: '#/components/schemas/Tools.FunctionCallOption' - Tools.PatchToolRequest: - type: object - properties: - name: - allOf: - - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: Name of the tool (must be unique for this agent and a valid python identifier string ) - description: - type: string - description: Description of the tool - function: - allOf: - - $ref: '#/components/schemas/Tools.FunctionDef' - description: The function to call - integration: - allOf: - - $ref: '#/components/schemas/Tools.IntegrationDefUpdate' - description: The integration to call - system: - allOf: - - $ref: '#/components/schemas/Tools.SystemDefUpdate' - description: The system to call - api_call: - allOf: - - $ref: '#/components/schemas/Tools.ApiCallDefUpdate' - description: The API call to make - description: Payload for patching a tool - Tools.SystemDef: - type: object - required: - - resource - - operation - properties: - resource: - type: string - enum: - - agent - - user - - task - - execution - - doc - - session - - job - description: Resource is the name of the resource to use - operation: - type: string - enum: - - create - - update - - patch - - create_or_update - - embed - - change_status - - search - - chat - - history - - delete - - get - - list - description: Operation is the name of the operation to perform - resource_id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Resource id (if applicable) - subresource: - type: string - enum: - - tool - - doc - - execution - - transition - description: Sub-resource type (if applicable) - arguments: - type: object - additionalProperties: {} - description: The arguments to pre-apply to the system call - description: System definition - Tools.SystemDefUpdate: - type: object - properties: - resource: - type: string - enum: - - agent - - user - - task - - execution - - doc - - session - - job - description: Resource is the name of the resource to use - operation: - type: string - enum: - - create - - update - - patch - - create_or_update - - embed - - change_status - - search - - chat - - history - - delete - - get - - list - description: Operation is the name of the operation to perform - resource_id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - description: Resource id (if applicable) - subresource: - type: string - enum: - - tool - - doc - - execution - - transition - description: Sub-resource type (if applicable) - arguments: - type: object - additionalProperties: {} - description: The arguments to pre-apply to the system call - description: System definition - Tools.Tool: - type: object - required: - - name - - created_at - - updated_at - - id - properties: - name: - allOf: - - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: Name of the tool (must be unique for this agent and a valid python identifier string ) - description: - type: string - description: Description of the tool - function: - allOf: - - $ref: '#/components/schemas/Tools.FunctionDef' - description: The function to call - integration: - allOf: - - $ref: '#/components/schemas/Tools.IntegrationDef' - description: The integration to call - system: - allOf: - - $ref: '#/components/schemas/Tools.SystemDef' - description: The system to call - api_call: - allOf: - - $ref: '#/components/schemas/Tools.ApiCallDef' - description: The API call to make - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - Tools.ToolResponse: - type: object - required: - - id - - output - properties: - id: - $ref: '#/components/schemas/Common.uuid' - output: - type: object - additionalProperties: {} - description: The output of the tool - Tools.ToolType: - type: string - enum: - - function - - integration - - system - - api_call - Tools.UpdateToolRequest: - type: object - required: - - name - properties: - name: - allOf: - - $ref: '#/components/schemas/Common.validPythonIdentifier' - description: Name of the tool (must be unique for this agent and a valid python identifier string ) - description: - type: string - description: Description of the tool - function: - allOf: - - $ref: '#/components/schemas/Tools.FunctionDef' - description: The function to call - integration: - allOf: - - $ref: '#/components/schemas/Tools.IntegrationDef' - description: The integration to call - system: - allOf: - - $ref: '#/components/schemas/Tools.SystemDef' - description: The system to call - api_call: - allOf: - - $ref: '#/components/schemas/Tools.ApiCallDef' - description: The API call to make - description: Payload for updating a tool - Users.CreateOrUpdateUserRequest: - type: object - required: - - id - properties: - id: - $ref: '#/components/schemas/Common.uuid' - allOf: - - $ref: '#/components/schemas/Users.CreateUserRequest' - Users.CreateUserRequest: - type: object - required: - - name - - about - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the user - default: '' - about: - type: string - description: About the user - default: '' - description: Payload for creating a user (and associated documents) - Users.PatchUserRequest: - type: object - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the user - default: '' - about: - type: string - description: About the user - default: '' - description: Payload for patching a user - Users.UpdateUserRequest: - type: object - required: - - name - - about - properties: - metadata: - type: object - additionalProperties: {} - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the user - default: '' - about: - type: string - description: About the user - default: '' - description: Payload for updating a user - Users.User: - type: object - required: - - id - - created_at - - updated_at - - name - - about - properties: - id: - allOf: - - $ref: '#/components/schemas/Common.uuid' - readOnly: true - metadata: - type: object - additionalProperties: {} - created_at: - type: string - format: date-time - description: When this resource was created as UTC date-time - readOnly: true - updated_at: - type: string - format: date-time - description: When this resource was updated as UTC date-time - readOnly: true - name: - allOf: - - $ref: '#/components/schemas/Common.identifierSafeUnicode' - description: Name of the user - default: '' - about: - type: string - description: About the user - default: '' - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: Authorization - ApiKeyAuth_: - type: apiKey - in: header - name: X-Auth-Key -servers: - - url: https://{serverEnv}.julep.ai/api - description: The julep cloud service endpoint - variables: - serverEnv: - default: api-alpha - description: The environment to use - enum: - - api - - api-alpha diff --git a/typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml b/typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml index 118d8adc8..91a8567d5 100644 --- a/typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml +++ b/typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml @@ -617,7 +617,9 @@ paths: type: object properties: body: - $ref: '#/components/schemas/Docs.EmbedQueryRequest' + anyOf: + - $ref: '#/components/schemas/Docs.SingleEmbedQueryRequest' + - $ref: '#/components/schemas/Docs.MultipleEmbedQueryRequest' required: - body /executions: @@ -2425,12 +2427,13 @@ components: required: - limit - lang + - metadata_filter properties: limit: type: integer format: uint16 minimum: 1 - maximum: 100 + maximum: 50 default: 10 lang: type: string @@ -2438,6 +2441,15 @@ components: - en-US description: The language to be used for text-only search. Support for other languages coming soon. default: en-US + metadata_filter: + type: object + additionalProperties: + anyOf: + - type: number + - type: string + - type: boolean + nullable: true + default: {} Docs.CreateDocRequest: type: object required: @@ -2573,23 +2585,6 @@ components: minimum: 0 exclusiveMinimum: true description: The time taken to search in seconds - Docs.EmbedQueryRequest: - type: object - required: - - text - - embed_instruction - properties: - text: - anyOf: - - type: string - - type: array - items: - type: string - description: Text or texts to embed - embed_instruction: - type: string - description: Instruction for the embedding model. - default: '' Docs.EmbedQueryResponse: type: object required: @@ -2632,6 +2627,36 @@ components: description: Vector to use in the search. Must be the same dimensions as the embedding model or else an error will be thrown. allOf: - $ref: '#/components/schemas/Docs.BaseDocSearchRequest' + Docs.MultipleEmbedQueryRequest: + type: object + required: + - text + - embed_instruction + properties: + text: + type: array + items: + type: string + minItems: 1 + maxItems: 100 + description: Texts to embed + embed_instruction: + type: string + description: Instruction for the embedding model. + default: '' + Docs.SingleEmbedQueryRequest: + type: object + required: + - text + - embed_instruction + properties: + text: + type: string + description: Text to embed + embed_instruction: + type: string + description: Instruction for the embedding model. + default: '' Docs.Snippet: type: object required: diff --git a/typespec/versions.tsp b/typespec/versions.tsp index 4739bbdf2..488e9927a 100644 --- a/typespec/versions.tsp +++ b/typespec/versions.tsp @@ -1,6 +1,5 @@ namespace Versions; enum ApiVersions { - v0_4: "0.4.0", v1_0: "1.0.0", }