diff --git a/src/backend/chat/enums.py b/src/backend/chat/enums.py index 01715f0989..49042bbec0 100644 --- a/src/backend/chat/enums.py +++ b/src/backend/chat/enums.py @@ -1,11 +1,10 @@ -from enum import Enum +from enum import StrEnum -class StreamEvent(str, Enum): +class StreamEvent(StrEnum): """ Stream Events returned by Cohere's chat stream response. """ - STREAM_START = "stream-start" SEARCH_QUERIES_GENERATION = "search-queries-generation" SEARCH_RESULTS = "search-results" diff --git a/src/backend/config/routers.py b/src/backend/config/routers.py index cd5dc324a4..ef82e1af71 100644 --- a/src/backend/config/routers.py +++ b/src/backend/config/routers.py @@ -22,6 +22,7 @@ class RouterName(StrEnum): CONVERSATION = "conversation" DEPLOYMENT = "deployment" EXPERIMENTAL_FEATURES = "experimental_features" + ORGANIZATION = "organization" TOOL = "tool" USER = "user" AGENT = "agent" @@ -90,6 +91,17 @@ class RouterName(StrEnum): Depends(validate_organization_header), ], }, + RouterName.ORGANIZATION: { + "default": [ + Depends(get_session), + Depends(validate_organization_header), + ], + "auth": [ + Depends(get_session), + Depends(validate_authorization), + Depends(validate_organization_header), + ], + }, RouterName.TOOL: { "default": [ Depends(get_session), diff --git a/src/backend/main.py b/src/backend/main.py index e86db4c7b0..4cbb3c9e02 100644 --- a/src/backend/main.py +++ b/src/backend/main.py @@ -45,6 +45,9 @@ ORIGINS = ["*"] +_RELEASE_VERSION = "v1.1.5" + + @asynccontextmanager async def lifespan(app: FastAPI): # Retrieves all the Auth provider endpoints if authentication is enabled. @@ -55,7 +58,12 @@ async def lifespan(app: FastAPI): def create_app() -> FastAPI: - app = FastAPI(lifespan=lifespan) + app = FastAPI( + title="Cohere Toolkit API", + description="This is the API for the Open Source Cohere Toolkit", + version=_RELEASE_VERSION, + lifespan=lifespan, + ) routers = [ auth_router, @@ -151,7 +159,11 @@ async def health(): return {"status": "OK"} -@app.post("/migrate", dependencies=[Depends(verify_migrate_token)]) +@app.post( + "/migrate", + dependencies=[Depends(verify_migrate_token)], + include_in_schema=False, +) async def apply_migrations(): """ Applies Alembic migrations - useful for serverless applications diff --git a/src/backend/routers/agent.py b/src/backend/routers/agent.py index 7c81683382..b7d759d37c 100644 --- a/src/backend/routers/agent.py +++ b/src/backend/routers/agent.py @@ -1,5 +1,4 @@ import asyncio -from typing import Optional from fastapi import APIRouter, Depends, HTTPException from fastapi import File as RequestFile @@ -41,6 +40,14 @@ FileMetadata, UploadAgentFileResponse, ) +from backend.schemas.params.agent import ( + AgentIdPathParam, + AgentToolMetadataIdPathParam, + VisibilityQueryParam, +) +from backend.schemas.params.file import FileIdPathParam +from backend.schemas.params.organization import OrganizationIdQueryParam +from backend.schemas.params.shared import PaginationQueryParams from backend.services.agent import ( raise_db_error, validate_agent_exists, @@ -59,6 +66,7 @@ router = APIRouter( prefix="/v1/agents", + tags=[RouterName.AGENT], ) router.name = RouterName.AGENT @@ -72,19 +80,13 @@ ], ) async def create_agent( - session: DBSessionDep, agent: CreateAgentRequest, + session: DBSessionDep, ctx: Context = Depends(get_context), ) -> AgentPublic: """ Create an agent. - Args: - session (DBSessionDep): Database session. - agent (CreateAgentRequest): Agent data. - ctx (Context): Context object. - Returns: - AgentPublic: Created agent with no user ID or organization ID. Raises: HTTPException: If the agent creation fails. """ @@ -144,24 +146,14 @@ async def create_agent( @router.get("", response_model=list[AgentPublic]) async def list_agents( *, - offset: int = 0, - limit: int = 100, + page_params: PaginationQueryParams, + visibility: VisibilityQueryParam = AgentVisibility.ALL, + organization_id: OrganizationIdQueryParam = None, session: DBSessionDep, - visibility: AgentVisibility = AgentVisibility.ALL, - organization_id: Optional[str] = None, ctx: Context = Depends(get_context), ) -> list[AgentPublic]: """ List all agents. - - Args: - offset (int): Offset to start the list. - limit (int): Limit of agents to be listed. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - list[AgentPublic]: List of agents with no user ID or organization ID. """ logger = ctx.get_logger() # TODO: get organization_id from user @@ -176,8 +168,8 @@ async def list_agents( agents = agent_crud.get_agents( session, user_id=user_id, - offset=offset, - limit=limit, + offset=page_params.offset, + limit=page_params.limit, visibility=visibility, organization_id=organization_id, ) @@ -192,16 +184,12 @@ async def list_agents( @router.get("/{agent_id}", response_model=AgentPublic) async def get_agent_by_id( - agent_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + agent_id: AgentIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context) ) -> AgentPublic: """ - Args: - agent_id (str): Agent ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - Agent: Agent. + Return an agent by ID. Raises: HTTPException: If the agent with the given ID is not found. @@ -230,17 +218,13 @@ async def get_agent_by_id( @router.get("/{agent_id}/deployments", response_model=list[DeploymentDefinition]) -async def get_agent_deployments( - agent_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) +async def get_agent_deployment( + agent_id: AgentIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context) ) -> list[DeploymentDefinition]: """ - Args: - agent_id (str): Agent ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - Agent: Agent. + Get the deployment for an agent Raises: HTTPException: If the agent with the given ID is not found. @@ -266,23 +250,14 @@ async def get_agent_deployments( ], ) async def update_agent( - agent_id: str, - new_agent: UpdateAgentRequest, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + new_agent: UpdateAgentRequest, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> AgentPublic: """ Update an agent by ID. - Args: - agent_id (str): Agent ID. - new_agent (UpdateAgentRequest): New agent data. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - AgentPublic: Updated agent with no user ID or organization ID. - Raises: HTTPException: If the agent with the given ID is not found. """ @@ -302,7 +277,7 @@ async def update_agent( try: db_deployment, db_model = get_deployment_model_from_agent(new_agent, session) - new_agent_db = UpdateAgentDB(**new_agent.dict()) + new_agent_db = UpdateAgentDB(**new_agent.model_dump()) if db_deployment and db_model: new_agent_db.model_id = db_model.id new_agent_db.deployment_id = db_deployment.id @@ -323,21 +298,13 @@ async def update_agent( @router.delete("/{agent_id}", response_model=DeleteAgent) async def delete_agent( - agent_id: str, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> DeleteAgent: """ Delete an agent by ID. - Args: - agent_id (str): Agent ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteAgent: Empty response. - Raises: HTTPException: If the agent with the given ID is not found. """ @@ -357,10 +324,10 @@ async def delete_agent( async def handle_tool_metadata_update( - agent: Agent, - new_agent: Agent, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent: Agent, + new_agent: Agent, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> Agent: """Update or create tool metadata for an agent. @@ -398,10 +365,10 @@ async def handle_tool_metadata_update( async def update_or_create_tool_metadata( - agent: Agent, - new_tool_metadata: AgentToolMetadata, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent: Agent, + new_tool_metadata: AgentToolMetadata, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> None: """Update or create tool metadata for an agent. @@ -416,30 +383,24 @@ async def update_or_create_tool_metadata( existing_tools_names = [metadata.tool_name for metadata in agent.tools_metadata] if new_tool_metadata.tool_name in existing_tools_names or new_tool_metadata.id: await update_agent_tool_metadata( - agent.id, new_tool_metadata.id, session, new_tool_metadata, ctx + agent.id, new_tool_metadata.id, new_tool_metadata, session, ctx ) else: create_metadata_req = CreateAgentToolMetadataRequest( **new_tool_metadata.model_dump(exclude_none=True) ) - create_agent_tool_metadata(session, agent.id, create_metadata_req, ctx) + create_agent_tool_metadata(agent.id, create_metadata_req, session, ctx) @router.get("/{agent_id}/tool-metadata", response_model=list[AgentToolMetadataPublic]) async def list_agent_tool_metadata( - agent_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + agent_id: AgentIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context) ) -> list[AgentToolMetadataPublic]: """ List all agent tool metadata by agent ID. - Args: - agent_id (str): Agent ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - list[AgentToolMetadataPublic]: List of agent tool metadata with no user ID or organization ID. - Raises: HTTPException: If the agent tool metadata retrieval fails. """ @@ -459,23 +420,14 @@ async def list_agent_tool_metadata( response_model=AgentToolMetadataPublic, ) def create_agent_tool_metadata( - session: DBSessionDep, - agent_id: str, - agent_tool_metadata: CreateAgentToolMetadataRequest, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + agent_tool_metadata: CreateAgentToolMetadataRequest, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> AgentToolMetadataPublic: """ Create an agent tool metadata. - Args: - session (DBSessionDep): Database session. - agent_id (str): Agent ID. - agent_tool_metadata (CreateAgentToolMetadataRequest): Agent tool metadata data. - ctx (Context): Context object. - - Returns: - AgentToolMetadataPublic: Created agent tool metadata. - Raises: HTTPException: If the agent tool metadata creation fails. """ @@ -508,25 +460,15 @@ def create_agent_tool_metadata( @router.put("/{agent_id}/tool-metadata/{agent_tool_metadata_id}") async def update_agent_tool_metadata( - agent_id: str, - agent_tool_metadata_id: str, - session: DBSessionDep, - new_agent_tool_metadata: UpdateAgentToolMetadataRequest, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + agent_tool_metadata_id: AgentToolMetadataIdPathParam, + new_agent_tool_metadata: UpdateAgentToolMetadataRequest, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> AgentToolMetadata: """ Update an agent tool metadata by ID. - Args: - agent_id (str): Agent ID. - agent_tool_metadata_id (str): Agent tool metadata ID. - session (DBSessionDep): Database session. - new_agent_tool_metadata (UpdateAgentToolMetadataRequest): New agent tool metadata data. - ctx (Context): Context object. - - Returns: - AgentToolMetadata: Updated agent tool metadata. - Raises: HTTPException: If the agent tool metadata with the given ID is not found. HTTPException: If the agent tool metadata update fails. @@ -552,23 +494,14 @@ async def update_agent_tool_metadata( @router.delete("/{agent_id}/tool-metadata/{agent_tool_metadata_id}") async def delete_agent_tool_metadata( - agent_id: str, - agent_tool_metadata_id: str, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + agent_tool_metadata_id: AgentToolMetadataIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> DeleteAgentToolMetadata: """ Delete an agent tool metadata by ID. - Args: - agent_id (str): Agent ID. - agent_tool_metadata_id (str): Agent tool metadata ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteAgentToolMetadata: Empty response. - Raises: HTTPException: If the agent tool metadata with the given ID is not found. HTTPException: If the agent tool metadata deletion fails. @@ -594,10 +527,14 @@ async def delete_agent_tool_metadata( @router.post("/batch_upload_file", response_model=list[UploadAgentFileResponse]) async def batch_upload_file( - session: DBSessionDep, - files: list[FastAPIUploadFile] = RequestFile(...), - ctx: Context = Depends(get_context), + *, + files: list[FastAPIUploadFile] = RequestFile(...), + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> UploadAgentFileResponse: + """ + Upload a batch of files + """ user_id = ctx.get_user_id() uploaded_files = [] @@ -618,23 +555,14 @@ async def batch_upload_file( @router.get("/{agent_id}/files/{file_id}", response_model=FileMetadata) async def get_agent_file( - agent_id: str, - file_id: str, + agent_id: AgentIdPathParam, + file_id: FileIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> FileMetadata: """ Get an agent file by ID. - Args: - agent_id (str): Agent ID. - file_id (str): File ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - FileMetadata: File with the given ID. - Raises: HTTPException: If the agent or file with the given ID is not found, or if the file does not belong to the agent. """ @@ -666,22 +594,14 @@ async def get_agent_file( @router.delete("/{agent_id}/files/{file_id}") async def delete_agent_file( - agent_id: str, - file_id: str, - session: DBSessionDep, - ctx: Context = Depends(get_context), + agent_id: AgentIdPathParam, + file_id: FileIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> DeleteAgentFileResponse: """ Delete an agent file by ID. - Args: - agent_id (str): Agent ID. - file_id (str): File ID. - session (DBSessionDep): Database session. - - Returns: - DeleteFile: Empty response. - Raises: HTTPException: If the agent with the given ID is not found. """ diff --git a/src/backend/routers/auth.py b/src/backend/routers/auth.py index 1f48e07168..079c2f9973 100644 --- a/src/backend/routers/auth.py +++ b/src/backend/routers/auth.py @@ -15,6 +15,8 @@ from backend.database_models.database import DBSessionDep from backend.schemas.auth import JWTResponse, ListAuthStrategy, Login, Logout from backend.schemas.context import Context +from backend.schemas.params.auth import CodeQueryParam, StrategyPathParam +from backend.schemas.params.tool import ToolIdPathParam from backend.schemas.tool_auth import DeleteToolAuth from backend.services.auth.jwt import JWTService from backend.services.auth.request_validators import validate_authorization @@ -25,7 +27,10 @@ from backend.services.cache import cache_get_dict from backend.services.context import get_context -router = APIRouter(prefix="/v1") +router = APIRouter( + prefix="/v1", + tags=[RouterName.AUTH], +) router.name = RouterName.AUTH @@ -35,11 +40,6 @@ def get_strategies( ) -> list[ListAuthStrategy]: """ Retrieves the currently enabled list of Authentication strategies. - - Args: - ctx (Context): Context object. - Returns: - List[dict]: List of dictionaries containing the enabled auth strategy names. """ strategies = [] for strategy_name, strategy_instance in ENABLED_AUTH_STRATEGY_MAPPING.items(): @@ -75,14 +75,6 @@ async def login( Logs user in, performing basic email/password auth. Verifies their credentials, retrieves the user and returns a JWT token. - Args: - login (Login): Login payload. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - dict: JWT token on Basic auth success - Raises: HTTPException: If the strategy or payload are invalid, or if the login fails. """ @@ -128,25 +120,16 @@ async def login( @router.post("/{strategy}/auth", response_model=JWTResponse) async def authorize( - strategy: str, + *, + strategy: StrategyPathParam, request: Request, + code: CodeQueryParam = None, session: DBSessionDep, - code: str = None, ctx: Context = Depends(get_context), ): """ Callback authorization endpoint used for OAuth providers after authenticating on the provider's login screen. - Args: - strategy (str): Current strategy name. - request (Request): Current Request object. - session (Session): DB session. - code (str): OAuth code. - ctx (Context): Context object. - - Returns: - dict: Containing "token" key, on success. - Raises: HTTPException: If authentication fails, or strategy is invalid. """ @@ -211,22 +194,12 @@ async def authorize( @router.get("/logout", response_model=Logout) async def logout( - request: Request, session: DBSessionDep, token: dict | None = Depends(validate_authorization), ctx: Context = Depends(get_context), ): """ Logs out the current user, adding the given JWT token to the blacklist. - - Args: - request (Request): current Request object. - session (DBSessionDep): Database session. - token (dict): JWT token payload. - ctx (Context): Context object. - - Returns: - dict: Empty on success """ if token is not None: db_blacklist = Blacklist(token_id=token["jti"]) @@ -237,8 +210,10 @@ async def logout( @router.get("/tool/auth") async def tool_auth( - request: Request, session: DBSessionDep, ctx: Context = Depends(get_context) -): + request: Request, + session: DBSessionDep, + ctx: Context = Depends(get_context), +) -> RedirectResponse: """ Endpoint for Tool Authentication. Note: The flow is different from the regular login OAuth flow, the backend initiates it and redirects to the frontend @@ -246,11 +221,6 @@ async def tool_auth( If completed, a ToolAuth is stored in the DB containing the access token for the tool. - Args: - request (Request): current Request object. - session (DBSessionDep): Database session. - ctx (Context): Context object. - Returns: RedirectResponse: A redirect pointing to the frontend, contains an error query parameter if an unexpected error happens during the authentication. @@ -326,7 +296,7 @@ def log_and_redirect_err(error_message: str): @router.delete("/tool/auth/{tool_id}") async def delete_tool_auth( - tool_id: str, + tool_id: ToolIdPathParam, request: Request, session: DBSessionDep, ctx: Context = Depends(get_context), @@ -336,15 +306,6 @@ async def delete_tool_auth( If completed, the corresponding ToolAuth for the requesting user is removed from the DB. - Args: - tool_id (str): Tool ID to be deleted for the user. (eg. google_drive) Should be one of the values listed in the Tool string enum class. - request (Request): current Request object. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteToolAuth: Empty response. - Raises: HTTPException: If there was an error deleting the tool auth. """ diff --git a/src/backend/routers/chat.py b/src/backend/routers/chat.py index 85ae6e0a26..191894f6b5 100644 --- a/src/backend/routers/chat.py +++ b/src/backend/routers/chat.py @@ -23,27 +23,19 @@ router = APIRouter( prefix="/v1", + tags=[RouterName.CHAT], ) router.name = RouterName.CHAT @router.post("/chat-stream", dependencies=[Depends(validate_deployment_header)]) async def chat_stream( - session: DBSessionDep, chat_request: CohereChatRequest, + session: DBSessionDep, ctx: Context = Depends(get_context), ) -> Generator[ChatResponseEvent, Any, None]: """ Stream chat endpoint to handle user messages and return chatbot responses. - - Args: - session (DBSessionDep): Database session. - chat_request (CohereChatRequest): Chat request data. - request (Request): Request object. - ctx (Context): Context object. - - Returns: - EventSourceResponse: Server-sent event response with chatbot responses. """ ctx.with_model(chat_request.model) agent_id = chat_request.agent_id @@ -83,21 +75,12 @@ async def chat_stream( @router.post("/chat-stream/regenerate", dependencies=[Depends(validate_deployment_header)]) async def regenerate_chat_stream( - session: DBSessionDep, chat_request: CohereChatRequest, + session: DBSessionDep, ctx: Context = Depends(get_context), ) -> EventSourceResponse: """ Endpoint to regenerate stream chat response for the last user message. - - Args: - session (DBSessionDep): Database session. - chat_request (CohereChatRequest): Chat request data. - request (Request): Request object. - ctx (Context): Context object. - - Returns: - EventSourceResponse: Server-sent event response with chatbot responses. """ ctx.with_model(chat_request.model) @@ -151,21 +134,12 @@ async def regenerate_chat_stream( @router.post("/chat", dependencies=[Depends(validate_deployment_header)]) async def chat( - session: DBSessionDep, chat_request: CohereChatRequest, + session: DBSessionDep, ctx: Context = Depends(get_context), ) -> NonStreamedChatResponse: """ Chat endpoint to handle user messages and return chatbot responses. - - Args: - chat_request (CohereChatRequest): Chat request data. - session (DBSessionDep): Database session. - request (Request): Request object. - ctx (Context): Context object. - - Returns: - NonStreamedChatResponse: Chatbot response. """ ctx.with_model(chat_request.model) agent_id = chat_request.agent_id diff --git a/src/backend/routers/conversation.py b/src/backend/routers/conversation.py index 537bbe798f..f61eb2db0a 100644 --- a/src/backend/routers/conversation.py +++ b/src/backend/routers/conversation.py @@ -1,6 +1,4 @@ -from typing import Optional - -from fastapi import APIRouter, Depends, Form, HTTPException, Request +from fastapi import APIRouter, Depends, Form, HTTPException from fastapi import File as RequestFile from fastapi import UploadFile as FastAPIUploadFile from starlette.responses import Response @@ -28,6 +26,12 @@ ListConversationFile, UploadConversationFileResponse, ) +from backend.schemas.params.agent import AgentIdQueryParam +from backend.schemas.params.conversation import ConversationIdPathParam, QueryQueryParam +from backend.schemas.params.file import FileIdPathParam +from backend.schemas.params.message import MessageIdPathParam +from backend.schemas.params.model import ModelQueryParam +from backend.schemas.params.shared import OrderByQueryParam, PaginationQueryParams from backend.services.agent import validate_agent_exists from backend.services.context import get_context from backend.services.conversation import ( @@ -46,6 +50,7 @@ router = APIRouter( prefix="/v1/conversations", + tags=[RouterName.CONVERSATION], ) router.name = RouterName.CONVERSATION @@ -53,22 +58,13 @@ # CONVERSATIONS @router.get("/{conversation_id}", response_model=ConversationPublic) async def get_conversation( - conversation_id: str, + conversation_id: ConversationIdPathParam, session: DBSessionDep, - request: Request, ctx: Context = Depends(get_context), ) -> ConversationPublic: """ Get a conversation by ID. - Args: - conversation_id (str): Conversation ID. - session (DBSessionDep): Database session. - request (Request): Request object. - - Returns: - ConversationPublic: Conversation with the given ID. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -112,32 +108,19 @@ async def get_conversation( @router.get("", response_model=list[ConversationWithoutMessages]) async def list_conversations( *, - offset: int = 0, - limit: int = 100, - order_by: str = None, - agent_id: str = None, + page_params: PaginationQueryParams, + order_by: OrderByQueryParam = None, + agent_id: AgentIdQueryParam = None, session: DBSessionDep, - request: Request, ctx: Context = Depends(get_context), ) -> list[ConversationWithoutMessages]: """ List all conversations. - - Args: - offset (int): Offset to start the list. - limit (int): Limit of conversations to be listed. - order_by (str): A field by which to order the conversations. - agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - session (DBSessionDep): Database session. - request (Request): Request object. - - Returns: - list[ConversationWithoutMessages]: List of conversations. """ user_id = ctx.get_user_id() conversations = conversation_crud.get_conversations( - session, offset=offset, limit=limit, order_by=order_by, user_id=user_id, agent_id=agent_id + session, offset=page_params.offset, limit=page_params.limit, order_by=order_by, user_id=user_id, agent_id=agent_id ) results = [] @@ -169,7 +152,7 @@ async def list_conversations( @router.put("/{conversation_id}", response_model=ConversationPublic) async def update_conversation( - conversation_id: str, + conversation_id: ConversationIdPathParam, new_conversation: UpdateConversationRequest, session: DBSessionDep, ctx: Context = Depends(get_context), @@ -177,15 +160,6 @@ async def update_conversation( """ Update a conversation by ID. - Args: - conversation_id (str): Conversation ID. - new_conversation (UpdateConversationRequest): New conversation data. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - ConversationPublic: Updated conversation. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -219,11 +193,14 @@ async def update_conversation( @router.put("/{conversation_id}/toggle-pin", response_model=ConversationWithoutMessages) async def toggle_conversation_pin( - conversation_id: str, + conversation_id: ConversationIdPathParam, new_conversation_pin: ToggleConversationPinRequest, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> ConversationWithoutMessages: + """ + Toggle whether a conversation is pinned or not + """ user_id = ctx.get_user_id() conversation = validate_conversation(session, conversation_id, user_id) conversation = conversation_crud.toggle_conversation_pin( @@ -252,19 +229,13 @@ async def toggle_conversation_pin( @router.delete("/{conversation_id}") async def delete_conversation( - conversation_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + conversation_id: ConversationIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> DeleteConversationResponse: """ Delete a conversation by ID. - Args: - conversation_id (str): Conversation ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteConversationResponse: Empty response. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -281,28 +252,16 @@ async def delete_conversation( @router.get(":search", response_model=list[ConversationWithoutMessages]) async def search_conversations( - query: str, + *, + query: QueryQueryParam, + page_params: PaginationQueryParams, + order_by: OrderByQueryParam = None, + agent_id: AgentIdQueryParam = None, session: DBSessionDep, - request: Request, - offset: int = 0, - limit: int = 100, - agent_id: str = None, ctx: Context = Depends(get_context), ) -> list[ConversationWithoutMessages]: """ Search conversations by title. - - Args: - query (str): Query string to search for in conversation titles. - session (DBSessionDep): Database session. - request (Request): Request object. - offset (int): Offset to start the list. - limit (int): Limit of conversations to be listed. - agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - ctx (Context): Context object. - - Returns: - list[ConversationWithoutMessages]: List of conversations that match the query. """ user_id = ctx.get_user_id() deployment_name = ctx.get_deployment_name() @@ -317,7 +276,7 @@ async def search_conversations( ctx.with_agent(agent_schema) conversations = conversation_crud.get_conversations( - session, offset=offset, limit=limit, user_id=user_id, agent_id=agent_id + session, offset=page_params.offset, limit=page_params.limit, order_by=order_by, user_id=user_id, agent_id=agent_id ) if not conversations: @@ -361,24 +320,16 @@ async def search_conversations( # FILES @router.post("/batch_upload_file", response_model=list[UploadConversationFileResponse]) async def batch_upload_file( - session: DBSessionDep, + *, conversation_id: str = Form(None), files: list[FastAPIUploadFile] = RequestFile(...), + session: DBSessionDep, ctx: Context = Depends(get_context), ) -> UploadConversationFileResponse: """ Uploads and creates a batch of File object. If no conversation_id is provided, a new Conversation is created as well. - Args: - session (DBSessionDep): Database session. - conversation_id (Optional[str]): Conversation ID passed from request query parameter. - files (list[FastAPIUploadFile]): List of files to be uploaded. - ctx (Context): Context object. - - Returns: - list[UploadConversationFileResponse]: List of uploaded files. - Raises: HTTPException: If the conversation with the given ID is not found. Status code 404. HTTPException: If the file wasn't uploaded correctly. Status code 500. @@ -435,19 +386,13 @@ async def batch_upload_file( @router.get("/{conversation_id}/files", response_model=list[ListConversationFile]) async def list_files( - conversation_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + conversation_id: ConversationIdPathParam, + session: DBSessionDep, ctx: + Context = Depends(get_context), ) -> list[ListConversationFile]: """ List all files from a conversation. Important - no pagination support yet. - Args: - conversation_id (str): Conversation ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - list[ListConversationFile]: List of files from the conversation. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -464,20 +409,14 @@ async def list_files( @router.get("/{conversation_id}/files/{file_id}", response_model=FileMetadata) async def get_file( - conversation_id: str, file_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + conversation_id: ConversationIdPathParam, + file_id: FileIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> FileMetadata: """ Get a conversation file by ID. - Args: - conversation_id (str): Conversation ID. - file_id (str): File ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - FileMetadata: File with the given ID. - Raises: HTTPException: If the conversation or file with the given ID is not found, or if the file does not belong to the conversation. """ @@ -505,22 +444,14 @@ async def get_file( @router.delete("/{conversation_id}/files/{file_id}") async def delete_file( - conversation_id: str, - file_id: str, + conversation_id: ConversationIdPathParam, + file_id: FileIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> DeleteConversationFileResponse: """ Delete a file by ID. - Args: - conversation_id (str): Conversation ID. - file_id (str): File ID. - session (DBSessionDep): Database session. - - Returns: - DeleteFile: Empty response. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -538,24 +469,15 @@ async def delete_file( # MISC @router.post("/{conversation_id}/generate-title", response_model=GenerateTitleResponse) async def generate_title( - conversation_id: str, + *, + conversation_id: ConversationIdPathParam, + model: ModelQueryParam = "command-r", session: DBSessionDep, - request: Request, - model: Optional[str] = "command-r", ctx: Context = Depends(get_context), ) -> GenerateTitleResponse: """ Generate a title for a conversation and update the conversation with the generated title. - Args: - conversation_id (str): Conversation ID. - session (DBSessionDep): Database session. - request (Request): Request object. - ctx (Context): Context object. - - Returns: - str: Generated title for the conversation. - Raises: HTTPException: If the conversation with the given ID is not found. """ @@ -592,23 +514,14 @@ async def generate_title( # SYNTHESIZE @router.get("/{conversation_id}/synthesize/{message_id}") async def synthesize_message( - conversation_id: str, - message_id: str, + conversation_id: ConversationIdPathParam, + message_id: MessageIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> Response: """ Generate a synthesized audio for a specific message in a conversation. - Args: - conversation_id (str): Conversation ID. - message_id (str): Message ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - Response: Synthesized audio file. - Raises: HTTPException: If the message with the given ID is not found or synthesis fails. """ diff --git a/src/backend/routers/deployment.py b/src/backend/routers/deployment.py index 1282504bd4..8037f6d19c 100644 --- a/src/backend/routers/deployment.py +++ b/src/backend/routers/deployment.py @@ -12,6 +12,10 @@ DeploymentUpdate, UpdateDeploymentEnv, ) +from backend.schemas.params.deployment import ( + AllQueryParam, + DeploymentIdPathParam, +) from backend.services import deployment as deployment_service from backend.services.context import get_context from backend.services.logger.utils import LoggerFactory @@ -24,6 +28,7 @@ router = APIRouter( prefix="/v1/deployments", + tags=[RouterName.DEPLOYMENT], ) router.name = RouterName.DEPLOYMENT @@ -34,17 +39,11 @@ dependencies=[Depends(validate_create_deployment_request)], ) def create_deployment( - deployment: DeploymentCreate, session: DBSessionDep + deployment: DeploymentCreate, + session: DBSessionDep, ) -> DeploymentDefinition: """ Create a new deployment. - - Args: - deployment (DeploymentCreate): Deployment data to be created. - session (DBSessionDep): Database session. - - Returns: - DeploymentDefinition: Created deployment. """ try: created = DeploymentDefinition.from_db_deployment( @@ -58,19 +57,13 @@ def create_deployment( @router.put("/{deployment_id}", response_model=DeploymentDefinition) def update_deployment( - deployment_id: str, new_deployment: DeploymentUpdate, session: DBSessionDep + deployment_id: DeploymentIdPathParam, + new_deployment: DeploymentUpdate, + session: DBSessionDep, ) -> DeploymentDefinition: """ Update a deployment. - Args: - deployment_id (str): Deployment ID. - new_deployment (DeploymentUpdate): Deployment data to be updated. - session (DBSessionDep): Database session. - - Returns: - Deployment: Updated deployment. - Raises: HTTPException: If deployment not found. """ @@ -84,12 +77,12 @@ def update_deployment( @router.get("/{deployment_id}", response_model=DeploymentDefinition) -def get_deployment(deployment_id: str, session: DBSessionDep) -> DeploymentDefinition: +def get_deployment( + deployment_id: DeploymentIdPathParam, + session: DBSessionDep, +) -> DeploymentDefinition: """ Get a deployment by ID. - - Returns: - Deployment: Deployment with the given ID. """ return mask_deployment_secrets( deployment_service.get_deployment_definition(session, deployment_id) @@ -98,17 +91,13 @@ def get_deployment(deployment_id: str, session: DBSessionDep) -> DeploymentDefin @router.get("", response_model=list[DeploymentDefinition]) def list_deployments( - session: DBSessionDep, all: bool = False, ctx: Context = Depends(get_context) + *, + all: AllQueryParam = False, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> list[DeploymentDefinition]: """ List all available deployments and their models. - - Args: - session (DBSessionDep) - all (bool): Include all deployments, regardless of availability. - ctx (Context): Context object. - Returns: - list[Deployment]: List of available deployment options. """ logger = ctx.get_logger() @@ -135,19 +124,12 @@ def list_deployments( @router.delete("/{deployment_id}") async def delete_deployment( - deployment_id: str, session: DBSessionDep + deployment_id: DeploymentIdPathParam, + session: DBSessionDep, ) -> DeleteDeployment: """ Delete a deployment by ID. - Args: - deployment_id (str): Deployment ID. - session (DBSessionDep): Database session. - request (Request): Request object. - - Returns: - DeleteDeployment: Empty response. - Raises: HTTPException: If the deployment with the given ID is not found. """ @@ -161,23 +143,16 @@ async def delete_deployment( return DeleteDeployment() -@router.post("/{deployment_id}/update_config") +@router.post("/{deployment_id}/update_config", response_model=DeploymentDefinition) async def update_config( - deployment_id: str, - session: DBSessionDep, + *, + deployment_id: DeploymentIdPathParam, env_vars: UpdateDeploymentEnv, valid_env_vars = Depends(validate_env_vars), -): + session: DBSessionDep, +) -> DeploymentDefinition: """ Set environment variables for the deployment. - - Args: - deployment_id (str): Deployment ID. - session (DBSessionDep): Database session. - env_vars (UpdateDeploymentEnv): Environment variables to set. - valid_env_vars (str): Validated environment variables. - Returns: - str: Empty string. """ return mask_deployment_secrets( deployment_service.update_config(session, deployment_id, valid_env_vars) diff --git a/src/backend/routers/experimental_features.py b/src/backend/routers/experimental_features.py index 944a34684d..843337d346 100644 --- a/src/backend/routers/experimental_features.py +++ b/src/backend/routers/experimental_features.py @@ -7,6 +7,7 @@ router = APIRouter( prefix="/v1/experimental_features", + tags=[RouterName.EXPERIMENTAL_FEATURES], ) router.name = RouterName.EXPERIMENTAL_FEATURES @@ -16,11 +17,6 @@ def list_experimental_features(ctx: Context = Depends(get_context)) -> dict[str, bool]: """ List all experimental features and if they are enabled - - Args: - ctx (Context): Context object. - Returns: - Dict[str, bool]: Experimental feature and their isEnabled state """ experimental_features = { "USE_AGENTS_VIEW": Settings().get('feature_flags.use_agents_view'), diff --git a/src/backend/routers/model.py b/src/backend/routers/model.py index 13f1b63d23..32565e0cdb 100644 --- a/src/backend/routers/model.py +++ b/src/backend/routers/model.py @@ -6,10 +6,13 @@ from backend.database_models.database import DBSessionDep from backend.schemas.model import DeleteModel, ModelCreate, ModelUpdate from backend.schemas.model import Model as ModelSchema +from backend.schemas.params.model import ModelIdPathParam +from backend.schemas.params.shared import PaginationQueryParams from backend.services.request_validators import validate_create_update_model_request router = APIRouter( prefix="/v1/models", + tags=[RouterName.MODEL], ) router.name = RouterName.MODEL @@ -22,16 +25,12 @@ Depends(validate_create_update_model_request), ], ) -def create_model(model: ModelCreate, session: DBSessionDep) -> Model: +def create_model( + model: ModelCreate, + session: DBSessionDep +) -> Model: """ Create a new model. - - Args: - model (ModelCreate): Model data to be created. - session (DBSessionDep): Database session. - - Returns: - ModelSchema: Created model. """ return model_crud.create_model(session, model) @@ -44,19 +43,13 @@ def create_model(model: ModelCreate, session: DBSessionDep) -> Model: ], ) def update_model( - model_id: str, new_model: ModelUpdate, session: DBSessionDep + model_id: ModelIdPathParam, + new_model: ModelUpdate, + session: DBSessionDep, ) -> ModelSchema: """ Update a model by ID. - Args: - model_id (str): Model ID. - new_model (ModelCreateUpdate): New model data. - session (DBSessionDep): Database session. - - Returns: - ModelSchema: Updated model. - Raises: HTTPException: If the model with the given ID is not found. """ @@ -68,12 +61,12 @@ def update_model( @router.get("/{model_id}", response_model=ModelSchema) -def get_model(model_id: str, session: DBSessionDep) -> ModelSchema: +def get_model( + model_id: ModelIdPathParam, + session: DBSessionDep, +) -> ModelSchema: """ Get a model by ID. - - Returns: - Model: Model with the given ID. """ model = model_crud.get_model(session, model_id) if not model: @@ -83,30 +76,23 @@ def get_model(model_id: str, session: DBSessionDep) -> ModelSchema: @router.get("", response_model=list[ModelSchema]) def list_models( - *, offset: int = 0, limit: int = 100, session: DBSessionDep + page_params: PaginationQueryParams, + session: DBSessionDep, ) -> list[ModelSchema]: """ List all available models - - Returns: - list[Model]: List of available models. """ - return model_crud.get_models(session, offset, limit) + return model_crud.get_models(session, page_params.offset, page_params.limit) @router.delete("/{model_id}") -async def delete_model(model_id: str, session: DBSessionDep) -> DeleteModel: +async def delete_model( + model_id: ModelIdPathParam, + session: DBSessionDep, +) -> DeleteModel: """ Delete a model by ID. - Args: - model_id (str): Model ID. - session (DBSessionDep): Database session. - request (Request): Request object. - - Returns: - DeleteModel: Empty response. - Raises: HTTPException: If the model with the given ID is not found. """ diff --git a/src/backend/routers/organization.py b/src/backend/routers/organization.py index 6c252f7c6c..33bbef3278 100644 --- a/src/backend/routers/organization.py +++ b/src/backend/routers/organization.py @@ -1,4 +1,4 @@ -from fastapi import APIRouter, Depends, HTTPException, Request +from fastapi import APIRouter, Depends, HTTPException from backend.config.routers import RouterName from backend.crud import organization as organization_crud @@ -11,12 +11,16 @@ UpdateOrganization, ) from backend.schemas.context import Context +from backend.schemas.params.organization import OrganizationIdPathParam from backend.schemas.user import User from backend.services.context import get_context from backend.services.request_validators import validate_organization_request -router = APIRouter(prefix="/v1/organizations") -router.name = RouterName.TOOL +router = APIRouter( + prefix="/v1/organizations", + tags=[RouterName.ORGANIZATION], +) +router.name = RouterName.ORGANIZATION @router.post( @@ -33,13 +37,6 @@ def create_organization( ) -> Organization: """ Create a new organization. - - Args: - organization (CreateOrganization): Organization data - session (DBSessionDep): Database session. - - Returns: - Organization: Created organization. """ organization_data = OrganizationModel(**organization.dict()) @@ -54,22 +51,13 @@ def create_organization( ], ) def update_organization( - organization_id: str, + organization_id: OrganizationIdPathParam, new_organization: UpdateOrganization, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> Organization: """ Update organization by ID. - - Args: - organization_id (str): Tool ID. - new_organization (ToolUpdate): New organization data. - session (DBSessionDep): Database session. - - Returns: - Organization: Updated organization. - """ organization = organization_crud.get_organization(session, organization_id) return organization_crud.update_organization( @@ -79,18 +67,12 @@ def update_organization( @router.get("/{organization_id}", response_model=Organization) def get_organization( - organization_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + organization_id: OrganizationIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> Organization: """ Get a organization by ID. - - Args: - organization_id (str): Tool ID. - session (DBSessionDep): Database session. - ctx: Context. - - Returns: - Organization: Organization with the given ID. """ organization = organization_crud.get_organization(session, organization_id) if not organization: @@ -100,19 +82,12 @@ def get_organization( @router.delete("/{organization_id}", response_model=DeleteOrganization) def delete_organization( - organization_id: str, + organization_id: OrganizationIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> DeleteOrganization: """ Delete a organization by ID. - - Args: - organization_id (str): Tool ID. - session (DBSessionDep): Database session. - - Returns: - DeleteOrganization: Organization deleted. """ organization = organization_crud.get_organization(session, organization_id) if not organization: @@ -124,19 +99,11 @@ def delete_organization( @router.get("", response_model=list[Organization]) def list_organizations( - request: Request, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> list[Organization]: """ List all available organizations. - - Args: - request (Request): Request object. - session (DBSessionDep): Database session. - - Returns: - list[Organization]: List of available organizations. """ all_organizations = organization_crud.get_organizations(session) return all_organizations @@ -144,17 +111,12 @@ def list_organizations( @router.get("/{organization_id}/users", response_model=list[User]) def get_organization_users( - organization_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + organization_id: OrganizationIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ) -> list[User]: """ Get organization users by ID. - - Args: - organization_id (str): Organization ID. - session (DBSessionDep): Database session. - - Returns: - list[User]: List of users in the organization """ organization = organization_crud.get_organization(session, organization_id) if not organization: diff --git a/src/backend/routers/scim.py b/src/backend/routers/scim.py index 1e03dd0b30..4b6a76b81e 100644 --- a/src/backend/routers/scim.py +++ b/src/backend/routers/scim.py @@ -1,5 +1,3 @@ -from typing import Optional - from fastapi import APIRouter, Depends from starlette.requests import Request from starlette.responses import JSONResponse, Response @@ -12,6 +10,11 @@ from backend.database_models import Group as DBGroup from backend.database_models import User as DBUser from backend.schemas.context import Context +from backend.schemas.params.scim import ( + GroupIdPathParam, + ScimPaginationQueryParams, + UserIdPathParam, +) from backend.schemas.scim import ( CreateGroup, CreateUser, @@ -25,9 +28,11 @@ ) from backend.services.context import get_context -SCIM_PREFIX = "/scim/v2" scim_auth = Settings().get('auth.scim') -router = APIRouter(prefix=SCIM_PREFIX) +router = APIRouter( + prefix="/scim/v2", + tags=[RouterName.SCIM] +) router.name = RouterName.SCIM @@ -49,47 +54,53 @@ async def scim_exception_handler(request: Request, exc: SCIMException) -> Respon @router.get("/Users") async def get_users( + page_params: ScimPaginationQueryParams, session: DBSessionDep, - count: int = 100, - start_index: int = 1, - filter: Optional[str] = None, ) -> ListUserResponse: - if filter: + """ + Return users + """ + if page_params.filter: try: - display_name = _parse_filter(filter) + display_name = _parse_filter(page_params.filter) except ValueError: raise SCIMException(status_code=400, detail="filter not supported") db_user = user_crud.get_user_by_user_name(session, display_name) if not db_user: return ListUserResponse( total_results=0, - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=[], ) return ListUserResponse( total_results=1, - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=[User.from_db_user(db_user)], ) db_users = user_crud.get_external_users( - session, offset=start_index - 1, limit=count + session, offset=page_params.start_index - 1, limit=page_params.count ) users = [User.from_db_user(db_user) for db_user in db_users] return ListUserResponse( total_results=len(users), - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=users, ) @router.get("/Users/{user_id}") async def get_user( - user_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + user_id: UserIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ): + """ + Get user by User ID + """ logger = ctx.get_logger() db_user = user_crud.get_user(session, user_id) if not db_user: @@ -100,7 +111,13 @@ async def get_user( @router.post("/Users", status_code=201) -async def create_user(user: CreateUser, session: DBSessionDep): +async def create_user( + user: CreateUser, + session: DBSessionDep, +): + """ + Create a new user + """ db_user = user_crud.get_user_by_external_id(session, user.externalId) if not db_user: db_user = DBUser() @@ -117,11 +134,14 @@ async def create_user(user: CreateUser, session: DBSessionDep): @router.put("/Users/{user_id}") async def update_user( - user_id: str, + user_id: UserIdPathParam, user: UpdateUser, session: DBSessionDep, ctx: Context = Depends(get_context), ): + """ + Update a user + """ logger = ctx.get_logger() db_user = user_crud.get_user(session, user_id) if not db_user: @@ -141,11 +161,14 @@ async def update_user( @router.patch("/Users/{user_id}") async def patch_user( - user_id: str, + user_id: UserIdPathParam, patch: PatchUser, session: DBSessionDep, ctx: Context = Depends(get_context), ): + """ + Patch a user + """ logger = ctx.get_logger() db_user = user_crud.get_user(session, user_id) if not db_user: @@ -163,45 +186,52 @@ async def patch_user( @router.get("/Groups") async def get_groups( + *, + page_params: ScimPaginationQueryParams, session: DBSessionDep, - count: int = 100, - start_index: int = 1, - filter: Optional[str] = None, ) -> ListGroupResponse: - if filter: + """ + Return Groups + """ + if page_params.filter: try: - display_name = _parse_filter(filter) + display_name = _parse_filter(page_params.filter) except ValueError: raise SCIMException(status_code=400, detail="filter not supported") db_group = group_crud.get_group_by_name(session, display_name) if not db_group: return ListGroupResponse( total_results=0, - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=[], ) return ListGroupResponse( total_results=1, - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=[Group.from_db_group(db_group)], ) - db_groups = group_crud.get_groups(session, offset=start_index - 1, limit=count) + db_groups = group_crud.get_groups(session, offset=page_params.start_index - 1, limit=page_params.count) groups = [Group.from_db_group(db_group) for db_group in db_groups] return ListGroupResponse( total_results=len(groups), - start_index=start_index, - items_per_page=count, + start_index=page_params.start_index, + items_per_page=page_params.count, resources=groups, ) @router.get("/Groups/{group_id}") async def get_group( - group_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + group_id: GroupIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ): + """ + Get group by group ID + """ logger = ctx.get_logger() db_group = group_crud.get_group(session, group_id) if not db_group: @@ -212,7 +242,13 @@ async def get_group( @router.post("/Groups", status_code=201) -async def create_group(group: CreateGroup, session: DBSessionDep): +async def create_group( + group: CreateGroup, + session: DBSessionDep, +): + """ + Create a group + """ db_group = group_crud.get_group_by_name(session, group.display_name) if not db_group: db_group = DBGroup() @@ -225,11 +261,14 @@ async def create_group(group: CreateGroup, session: DBSessionDep): @router.patch("/Groups/{group_id}") async def patch_group( - group_id: str, + group_id: GroupIdPathParam, patch: PatchGroup, session: DBSessionDep, ctx: Context = Depends(get_context), ): + """ + Patch a group + """ logger = ctx.get_logger() db_group = group_crud.get_group(session, group_id) if not db_group: @@ -266,8 +305,13 @@ async def patch_group( @router.delete("/Groups/{group_id}", status_code=204) async def delete_group( - group_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) + group_id: GroupIdPathParam, + session: DBSessionDep, + ctx: Context = Depends(get_context), ): + """ + Delete a group + """ logger = ctx.get_logger() db_group = group_crud.get_group(session, group_id) if not db_group: @@ -277,6 +321,9 @@ async def delete_group( def _get_email_from_scim_user(user: CreateUser | UpdateUser) -> str | None: + """ + Return the primary email or a SCIM user + """ for email_obj in user.emails: if email_obj.primary: return email_obj.value diff --git a/src/backend/routers/snapshot.py b/src/backend/routers/snapshot.py index 9d7ecf80ef..d1fbbc5969 100644 --- a/src/backend/routers/snapshot.py +++ b/src/backend/routers/snapshot.py @@ -5,6 +5,7 @@ from backend.crud import snapshot as snapshot_crud from backend.database_models.database import DBSessionDep from backend.schemas.context import Context +from backend.schemas.params.snapshot import LinkIdPathParam, SnapshotIdPathParam from backend.schemas.snapshot import ( CreateSnapshotRequest, CreateSnapshotResponse, @@ -25,7 +26,10 @@ wrap_create_snapshot_link, ) -router = APIRouter(prefix="/v1/snapshots") +router = APIRouter( + prefix="/v1/snapshots", + tags=[RouterName.SNAPSHOT], +) router.name = RouterName.SNAPSHOT PRIVATE_KEYS = ["organization_id", "user_id", "conversation_id"] @@ -39,14 +43,6 @@ async def create_snapshot( ) -> CreateSnapshotResponse: """ Create a new snapshot and snapshot link to share the conversation. - - Args: - snapshot_request (CreateSnapshotRequest): Snapshot creation request. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - CreateSnapshotResponse: Snapshot creation response. """ user_id = ctx.get_user_id() conversation_id = snapshot_request.conversation_id @@ -81,13 +77,6 @@ async def list_snapshots( ) -> list[SnapshotWithLinks]: """ List all snapshots. - - Args: - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - list[SnapshotWithLinks]: List of all snapshots with their links. """ user_id = ctx.get_user_id() @@ -109,20 +98,12 @@ async def list_snapshots( @router.get("/link/{link_id}", response_model=SnapshotPublic) async def get_snapshot( - link_id: str, + link_id: LinkIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> SnapshotPublic: """ Get a snapshot by link ID. - - Args: - link_id (str): Snapshot link ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - Snapshot: Snapshot with the given link ID. """ user_id = ctx.get_user_id() @@ -135,20 +116,12 @@ async def get_snapshot( @router.delete("/link/{link_id}") async def delete_snapshot_link( - link_id: str, + link_id: LinkIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> DeleteSnapshotLinkResponse: """ Delete a snapshot link by ID. - - Args: - link_id (str): Snapshot link ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteSnapshotLinkResponse: Empty response. """ user_id = ctx.get_user_id() @@ -168,20 +141,12 @@ async def delete_snapshot_link( @router.delete("/{snapshot_id}") async def delete_snapshot( - snapshot_id: str, + snapshot_id: SnapshotIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> DeleteSnapshotResponse: """ Delete a snapshot by ID. - - Args: - snapshot_id (str): Snapshot ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteSnapshotResponse: Empty response. """ user_id = ctx.get_user_id() diff --git a/src/backend/routers/tool.py b/src/backend/routers/tool.py index b453f81e28..5dc4bc7bd5 100644 --- a/src/backend/routers/tool.py +++ b/src/backend/routers/tool.py @@ -1,34 +1,30 @@ -from fastapi import APIRouter, Depends, Request +from fastapi import APIRouter, Depends from backend.config.routers import RouterName from backend.config.tools import get_available_tools from backend.database_models.database import DBSessionDep from backend.schemas.context import Context +from backend.schemas.params.agent import AgentIdQueryParam from backend.schemas.tool import ToolDefinition from backend.services.agent import validate_agent_exists from backend.services.context import get_context -router = APIRouter(prefix="/v1/tools") +router = APIRouter( + prefix="/v1/tools", + tags=[RouterName.TOOL], +) router.name = RouterName.TOOL @router.get("", response_model=list[ToolDefinition]) def list_tools( - request: Request, + *, + agent_id: AgentIdQueryParam = None, session: DBSessionDep, - agent_id: str | None = None, ctx: Context = Depends(get_context), ) -> list[ToolDefinition]: """ List all available tools. - - Args: - request (Request): The request to validate - session (DBSessionDep): Database session. - agent_id (str): Agent ID. - ctx (Context): Context object. - Returns: - list[ToolDefinition]: List of available tools. """ user_id = ctx.get_user_id() logger = ctx.get_logger() diff --git a/src/backend/routers/user.py b/src/backend/routers/user.py index 8b13d9649a..61e5e4a49c 100644 --- a/src/backend/routers/user.py +++ b/src/backend/routers/user.py @@ -1,15 +1,20 @@ -from fastapi import APIRouter, Depends, HTTPException, Request +from fastapi import APIRouter, Depends, HTTPException from backend.config.routers import RouterName from backend.crud import user as user_crud from backend.database_models import User as UserModel from backend.database_models.database import DBSessionDep from backend.schemas.context import Context +from backend.schemas.params.shared import PaginationQueryParams +from backend.schemas.params.user import UserIdPathParam from backend.schemas.user import CreateUser, DeleteUser, UpdateUser, User from backend.schemas.user import User as UserSchema from backend.services.context import get_context -router = APIRouter(prefix="/v1/users") +router = APIRouter( + prefix="/v1/users", + tags=[RouterName.USER], +) router.name = RouterName.USER @@ -21,14 +26,6 @@ async def create_user( ) -> User: """ Create a new user. - - Args: - user (CreateUser): User data to be created. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - User: Created user. """ db_user = UserModel(**user.model_dump(exclude_none=True)) db_user = user_crud.create_user(session, db_user) @@ -41,44 +38,25 @@ async def create_user( @router.get("", response_model=list[User]) async def list_users( - *, - offset: int = 0, - limit: int = 100, + page_params: PaginationQueryParams, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> list[User]: """ List all users. - - Args: - offset (int): Offset to start the list. - limit (int): Limit of users to be listed. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - list[User]: List of users. """ - return user_crud.get_users(session, offset=offset, limit=limit) + return user_crud.get_users(session, offset=page_params.offset, limit=page_params.limit) @router.get("/{user_id}", response_model=User) async def get_user( - user_id: str, + user_id: UserIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> User: """ Get a user by ID. - Args: - user_id (str): User ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - User: User with the given ID. - Raises: HTTPException: If the user with the given ID is not found. """ @@ -96,25 +74,14 @@ async def get_user( @router.put("/{user_id}", response_model=User) async def update_user( - user_id: str, + user_id: UserIdPathParam, new_user: UpdateUser, session: DBSessionDep, - request: Request, ctx: Context = Depends(get_context), ) -> User: """ Update a user by ID. - Args: - user_id (str): User ID. - new_user (UpdateUser): New user data. - session (DBSessionDep): Database session. - request (Request): Request object. - ctx (Context): Context object - - Returns: - User: Updated user. - Raises: HTTPException: If the user with the given ID is not found. """ @@ -134,21 +101,13 @@ async def update_user( @router.delete("/{user_id}") async def delete_user( - user_id: str, + user_id: UserIdPathParam, session: DBSessionDep, ctx: Context = Depends(get_context), ) -> DeleteUser: - """ " + """ Delete a user by ID. - Args: - user_id (str): User ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteUser: Empty response. - Raises: HTTPException: If the user with the given ID is not found. """ diff --git a/src/backend/schemas/agent.py b/src/backend/schemas/agent.py index 5719f7e55c..d678fb3246 100644 --- a/src/backend/schemas/agent.py +++ b/src/backend/schemas/agent.py @@ -1,4 +1,5 @@ import datetime +from abc import ABC from enum import StrEnum from typing import Optional @@ -6,25 +7,70 @@ class AgentVisibility(StrEnum): + """ + Supported values for Agent Visibility + """ PRIVATE = "private" PUBLIC = "public" ALL = "all" -class AgentBase(BaseModel): - user_id: str - organization_id: Optional[str] = None +class AgentBase(ABC, BaseModel): + """ + Abstract base class for Agent Schemas + """ + user_id: str = Field( + ..., + title="User ID", + description="User ID for the Agent", + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Organization ID for the Agent", + ) class AgentToolMetadata(BaseModel): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - user_id: Optional[str] - agent_id: str - tool_name: str - artifacts: list[dict] + """ + Agent tool metadata schema + """ + id: str = Field( + ..., + title="ID", + description="Agent tool metadata ID", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When the agent tool metadata was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When the agent tool metadata was updated", + ) + + user_id: Optional[str] = Field( + None, + title="User ID", + description="User ID for the agent tool metadata", + ) + agent_id: str = Field( + ..., + title="Agent ID", + description="Agent ID for the agent tool metadata", + ) + tool_name: str = Field( + ..., + title="Tool Name", + description="Tool Name for the agent tool metadata", + ) + artifacts: list[dict] = Field( + ..., + title="Artifacts", + description="Artifacts for the agent tool metadata", + ) class Config: from_attributes = True @@ -32,44 +78,141 @@ class Config: class AgentToolMetadataPublic(AgentToolMetadata): - user_id: Optional[str] = Field(exclude=True) + """ + Public agent tool metadata schema + """ + user_id: Optional[str] = Field( + None, + title="User ID", + description="User ID for the agent tool metadata", + exclude=True, + ) class Config: from_attributes = True -class CreateAgentToolMetadataRequest(BaseModel): - id: Optional[str] = None - tool_name: str - artifacts: list[dict] - - -class UpdateAgentToolMetadataRequest(BaseModel): - id: Optional[str] = None - tool_name: Optional[str] = None - artifacts: Optional[list[dict]] = None +class AgentToolMedatadataBaseRequest(ABC, BaseModel): + """ + Abstract class for creating/updating Agent Tool Metadata + """ + id: Optional[str] = Field( + None, + title="ID", + description="Agent Tool Metadata ID", + ) + + +class CreateAgentToolMetadataRequest(AgentToolMedatadataBaseRequest): + """ + Request to create Agent Tool Metadata + """ + tool_name: str = Field( + ..., + title="Tool Name", + description="Tool Name for the agent tool metadata", + ) + artifacts: list[dict] = Field( + ..., + title="Artifacts", + description="Artifacts for the agent tool metadata", + ) + + +class UpdateAgentToolMetadataRequest(AgentToolMedatadataBaseRequest): + """ + Request to update Agent Tool Metadata + """ + tool_name: Optional[str] = Field( + None, + title="Tool Name", + description="Tool Name for the agent tool metadata", + ) + artifacts: Optional[list[dict]] = Field( + None, + title="Artifacts", + description="Artifacts for the agent tool metadata", + ) class DeleteAgentToolMetadata(BaseModel): + """ + Delete agent tool metadata response + """ pass # Agent class Agent(AgentBase): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - version: int - name: str - description: Optional[str] - preamble: Optional[str] - temperature: float - tools: Optional[list[str]] - tools_metadata: list[AgentToolMetadataPublic] - deployment: Optional[str] - model: Optional[str] - is_private: Optional[bool] + """ + Agent schema + """ + id: str = Field( + ..., + title="ID", + description="Agent ID", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When the agent was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When the agent was updated", + ) + + name: str = Field( + ..., + title="Name", + description="Name of the Agent", + ) + version: int = Field( + ..., + title="Version", + description="Version of the Agent", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Agent Description", + ) + preamble: Optional[str] = Field( + None, + title="Preamble", + description="The preamble for the Agent", + ) + temperature: float = Field( + ..., + title="Temperature", + description="The temperature for the Agent", + ) + tools: Optional[list[str]] = Field( + None, + title="Tools", + description="List of tools for the Agent", + ) + tools_metadata: list[AgentToolMetadataPublic] = Field( + ..., + title="Tools Metadata", + description="List of tool metadata for the Agent", + ) + deployment: Optional[str] = Field( + None, + title="Deployment", + description="Deployment for the Agent", + ) + model: Optional[str] = Field( + None, + title="Model", + description="Model for the Agent", + ) + is_private: Optional[bool] = Field( + None, + title="Is Private", + description="If the Agent is private", + ) class Config: from_attributes = True @@ -77,25 +220,88 @@ class Config: class AgentPublic(Agent): - organization_id: Optional[str] = Field(exclude=True) - tools_metadata: Optional[list[AgentToolMetadataPublic]] = None + """ + Public agent schema + """ + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Organization ID for the Agent", + exclude=True, + ) + tools_metadata: Optional[list[AgentToolMetadataPublic]] = Field( + None, + title="Tools Metadata", + description="List of tool metadata for the Agent", + ) class CreateAgentRequest(BaseModel): - name: str - version: Optional[int] = None - description: Optional[str] = None - preamble: Optional[str] = None - temperature: Optional[float] = None - tools: Optional[list[str]] = None - tools_metadata: Optional[list[CreateAgentToolMetadataRequest]] = None - deployment_config: Optional[dict[str, str]] = None - # model_id or model_name - model: str + """ + Schema to create an agent + """ + name: str = Field( + ..., + title="Name", + description="Name of the Agent", + ) + version: Optional[int] = Field( + None, + title="Version", + description="Version of the Agent", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Agent Description", + ) + preamble: Optional[str] = Field( + None, + title="Preamble", + description="The preamble for the Agent", + ) + temperature: Optional[float] = Field( + None, + title="Temperature", + description="The temperature for the Agent", + ) + tools: Optional[list[str]] = Field( + None, + title="Tools", + description="List of tools for the Agent", + ) + tools_metadata: Optional[list[CreateAgentToolMetadataRequest]] = Field( + None, + title="Tools Metadata", + description="Tools metadata for the Agent", + ) # deployment_id or deployment_name - deployment: str - organization_id: Optional[str] = None - is_private: Optional[bool] = False + deployment: str = Field( + ..., + title="Deployment", + description="Deployment for the Agent", + ) + deployment_config: Optional[dict[str, str]] = Field( + None, + title="Deployment Config", + description="Deployment config for the Agent", + ) + # model_id or model_name + model: str = Field( + ..., + title="Model", + description="Model for the Agent", + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Organization ID for the Agent", + ) + is_private: Optional[bool] = Field( + False, + title="Is Private", + description="If the Agent is private", + ) class Config: from_attributes = True @@ -103,26 +309,79 @@ class Config: class ListAgentsResponse(BaseModel): - agents: list[Agent] - - -class UpdateAgentNoDeploymentModel(BaseModel): - name: Optional[str] = None - version: Optional[int] = None - description: Optional[str] = None - preamble: Optional[str] = None - temperature: Optional[float] = None - tools: Optional[list[str]] = None - organization_id: Optional[str] = None - is_private: Optional[bool] = None + """ + Response schema for listing agents + """ + agents: list[Agent] = Field( + ..., + title="Agents", + description="List of Agents", + ) + + +class UpdateAgentNoDeploymentModel(ABC, BaseModel): + """ + Abstract class for updating agents + """ + name: Optional[str] = Field( + None, + title="Name", + description="Name of the Agent", + ) + version: Optional[int] = Field( + None, + title="Version", + description="Version of the Agent", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Agent Description", + ) + preamble: Optional[str] = Field( + None, + title="Preamble", + description="The preamble for the Agent", + ) + temperature: Optional[float] = Field( + None, + title="Temperature", + description="The temperature for the Agent", + ) + tools: Optional[list[str]] = Field( + None, + title="Tools", + description="List of tools for the Agent", + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Organization ID for the Agent", + ) + is_private: Optional[bool] = Field( + None, + title="Is Private", + description="If the Agent is private", + ) class Config: from_attributes = True use_enum_values = True class UpdateAgentDB(UpdateAgentNoDeploymentModel): - model_id: Optional[str] = None - deployment_id: Optional[str] = None + """ + Model for updating agents + """ + model_id: Optional[str] = Field( + None, + title="Model ID", + description="Model ID", + ) + deployment_id: Optional[str] = Field( + None, + title="Deployment ID", + description="Deployment ID", + ) model_config = { "from_attributes": True, @@ -132,13 +391,31 @@ class UpdateAgentDB(UpdateAgentNoDeploymentModel): class UpdateAgentRequest(UpdateAgentNoDeploymentModel): - deployment: Optional[str] = None - model: Optional[str] = None - tools_metadata: Optional[list[CreateAgentToolMetadataRequest]] = None + """ + Schema to update an agent + """ + deployment: Optional[str] = Field( + None, + title="Deployment", + description="Deployment for the Agent", + ) + model: Optional[str] = Field( + None, + title="Model", + description="Model for the Agent", + ) + tools_metadata: Optional[list[CreateAgentToolMetadataRequest]] = Field( + None, + title="Tools Metadata", + description="Tools metadata for the Agent", + ) class Config: from_attributes = True use_enum_values = True class DeleteAgent(BaseModel): + """ + Response for deleting an agent + """ pass diff --git a/src/backend/schemas/auth.py b/src/backend/schemas/auth.py index 621f45e14a..055d6f1e80 100644 --- a/src/backend/schemas/auth.py +++ b/src/backend/schemas/auth.py @@ -1,26 +1,70 @@ +from abc import ABC from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field -class Auth(BaseModel): - strategy: str +class Auth(ABC, BaseModel): + """ + Abstract class for Auth Schemas + """ + strategy: str = Field( + ..., + title="Strategy", + description="Auth strategy to use", + ) class Login(Auth): - payload: Optional[dict[str, str]] = None + """ + Login Request + """ + payload: Optional[dict[str, str]] = Field( + None, + title="Payload", + description="Login payload depending on strategy used", + ) class Logout(BaseModel): + """ + Logout Request + """ pass class ListAuthStrategy(BaseModel): - strategy: str - client_id: str | None - authorization_endpoint: str | None - pkce_enabled: bool + """ + List Auth Strategy + """ + strategy: str = Field( + ..., + title="Strategy", + description="Auth strategy name", + ) + client_id: Optional[str] = Field( + None, + title="Client ID", + description="Client ID to be used", + ) + authorization_endpoint: Optional[str] = Field( + None, + title="Authorization Endpoint", + description="The endpoint for authorization", + ) + pkce_enabled: bool = Field( + ..., + title="PKCE Enabled", + description="If PKCE is enabled", + ) class JWTResponse(BaseModel): - token: str + """ + JWT Response + """ + token: str = Field( + ..., + title="Token", + description="JSON Web Token", + ) diff --git a/src/backend/schemas/chat.py b/src/backend/schemas/chat.py index b83586903d..5882d5b81b 100644 --- a/src/backend/schemas/chat.py +++ b/src/backend/schemas/chat.py @@ -1,6 +1,7 @@ +from abc import ABC from dataclasses import dataclass from enum import StrEnum -from typing import Any, ClassVar, Dict, List, Union +from typing import Any, ClassVar, Optional, Union from uuid import uuid4 from pydantic import BaseModel, Field @@ -19,9 +20,11 @@ class EventState: previous_plan: str previous_action: str -class ChatRole(StrEnum): - """One of CHATBOT|USER|SYSTEM to identify who the message is coming from.""" +class ChatRole(StrEnum): + """ + One of CHATBOT|USER|SYSTEM to identify who the message is coming from. + """ CHATBOT = "CHATBOT" USER = "USER" SYSTEM = "SYSTEM" @@ -29,43 +32,54 @@ class ChatRole(StrEnum): class ChatCitationQuality(StrEnum): - """Dictates the approach taken to generating citations by allowing the user to specify whether they want "accurate" results or "fast" results. Defaults to "accurate".""" - + """ + Dictates the approach taken to generating citations by allowing the user to specify + whether they want "accurate" results or "fast" results. Defaults to "accurate". + """ FAST = "FAST" ACCURATE = "ACCURATE" class ToolInputType(StrEnum): - """Type of input passed to the tool""" - + """ + Type of input passed to the tool + """ QUERY = "QUERY" CODE = "CODE" class ChatMessage(BaseModel): - """A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.""" - + """ + A list of previous messages between the user and the model, meant to give the mode + conversational context for responding to the user's message. + """ role: ChatRole = Field( - title="One of CHATBOT|USER|SYSTEM to identify who the message is coming from.", + ..., + title="Role", + description="One of CHATBOT|USER|SYSTEM to identify who the message is coming from.", ) - message: str | None = Field( - title="Contents of the chat message.", - default=None, + message: Optional[str] = Field( + None, + title="Message", + description="Contents of the chat message.", ) - tool_plan: str | None = Field( - title="Contents of the tool plan.", - default=None, + tool_plan: Optional[str] = Field( + None, + title="Tool Plan", + description="Contents of the tool plan.", ) - tool_results: List[Dict[str, Any]] | None = Field( - title="Results from the tool call.", - default=None, + tool_results: Optional[list[dict[str, Any]]] = Field( + None, + title="Tool Results", + description="Results from the tool call.", ) - tool_calls: List[Dict[str, Any]] | None = Field( - title="List of tool calls generated for custom tools", - default=None, + tool_calls: Optional[list[dict[str, Any]]] = Field( + None, + title="Tool Calls", + description="List of tool calls generated for custom tools", ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: return { "role": self.role, "message": self.message, @@ -75,209 +89,302 @@ def to_dict(self) -> Dict[str, Any]: # TODO: fix titles of these types -class ChatResponse(BaseModel): - event_type: ClassVar[StreamEvent] = Field() +class ChatResponse(ABC, BaseModel): + """ + Abstract class for Chat Responses + """ + event_type: ClassVar[StreamEvent] = Field( + ..., + title="Event Type", + description="Chat response event type", + ) class StreamStart(ChatResponse): - """Stream start event.""" - + """Stream start event""" event_type: ClassVar[StreamEvent] = StreamEvent.STREAM_START - generation_id: str | None = Field(default=None) - conversation_id: str | None = Field(default=None) + generation_id: Optional[str] = Field( + None, + title="Generation ID", + description="Generation ID for the event", + ) + conversation_id: Optional[str] = Field( + None, + title="Conversation ID", + description="Conversation ID for the event", + ) class StreamTextGeneration(ChatResponse): - """Stream text generation event.""" - + """Stream text generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.TEXT_GENERATION - text: str = Field( - title="Contents of the chat message.", + ..., + title="Text", + description="Contents of the chat message", ) class StreamCitationGeneration(ChatResponse): - """Stream citation generation event.""" - + """Stream citation generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.CITATION_GENERATION - - citations: List[Citation] = Field( - title="Citations for the chat message.", default=[] + citations: list[Citation] = Field( + [], + title="Citations", + description="Citations for the chat message", ) class StreamQueryGeneration(ChatResponse): - """Stream query generation event.""" - + """Stream query generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.SEARCH_QUERIES_GENERATION - query: str = Field( - title="Search query used to generate grounded response with citations.", + ..., + title="Query", + description="Search query used to generate grounded response with citations", ) class StreamSearchResults(ChatResponse): + """Stream search generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.SEARCH_RESULTS - - search_results: List[Dict[str, Any]] = Field( - title="Search results used to generate grounded response with citations.", - default=[], + search_results: list[dict[str, Any]] = Field( + [], + title="Search Results", + description="Search results used to generate grounded response with citations", ) - documents: List[Document] = Field( - title="Documents used to generate grounded response with citations.", - default=[], + documents: list[Document] = Field( + [], + title="Documents", + description="Documents used to generate grounded response with citations", ) class StreamToolInput(ChatResponse): + """Stream tool input generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.TOOL_INPUT - input_type: ToolInputType - tool_name: str - input: str - text: str + input_type: ToolInputType = Field( + ..., + title="Input Type", + description="Tool input type", + ) + tool_name: str = Field( + ..., + title="Tool Name", + description="Name of the tool to be used", + ) + input: str = Field( + ..., + title="Input", + description="Tool input", + ) + text: str = Field( + ..., + title="Text", + description="Contents of the chat message", + ) class StreamToolResult(ChatResponse): + """Stream tool result generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.TOOL_RESULT - result: Any - tool_name: str - - documents: List[Document] = Field( - title="Documents used to generate grounded response with citations.", - default=[], + result: Any = Field( + ..., + title="Result", + description="Result from the tool", + ) + tool_name: str = Field( + ..., + title="Tool Name", + description="Name of tool that generated the result", + ) + documents: list[Document] = Field( + [], + title="Documents", + description="Documents used to generate grounded response with citations", ) class StreamSearchQueriesGeneration(ChatResponse): - """Stream queries generation event.""" - + """Stream queries generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.SEARCH_QUERIES_GENERATION - - search_queries: List[SearchQuery] = Field( - title="Search query used to generate grounded response with citations.", - default=[], + search_queries: list[SearchQuery] = Field( + [], + title="Search Queries", + description="Search query used to generate grounded response with citations", ) class StreamToolCallsGeneration(ChatResponse): - """Stream tool calls generation event.""" - + """Stream tool calls generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.TOOL_CALLS_GENERATION - - stream_search_results: StreamSearchResults | None = Field( - title="List of search results used to generate grounded response with citations", - default=[], + stream_search_results: Optional[StreamSearchResults] = Field( + None, + title="Stream Search Results", + description="Search results used to generate grounded response with citations", ) - - tool_calls: List[ToolCall] | None = Field( - title="List of tool calls generated for custom tools", - default=[], + tool_calls: Optional[list[ToolCall]] = Field( + [], + title="Tool Calls", + description="List of tool calls generated for custom tools", ) - text: str | None = Field( - title="Contents of the chat message.", + None, + title="Text", + description="Contents of the chat message", ) class StreamEnd(ChatResponse): - message_id: str | None = Field(default=None) - response_id: str | None = Field(default=None) + """Stream end generation event""" event_type: ClassVar[StreamEvent] = StreamEvent.STREAM_END - generation_id: str | None = Field(default=None) - conversation_id: str | None = Field(default=None) + message_id: Optional[str] = Field( + None, + title="Message ID", + description="Unique identifier for the message", + ) + response_id: Optional[str] = Field( + None, + title="Response ID", + description="Unique identifier for the response", + ) + generation_id: Optional[str] = Field( + None, + title="Generation ID", + description="Unique identifier for the generation", + ) + conversation_id: Optional[str] = Field( + None, + title="Conversation ID", + description="Unique identifier for the conversation", + ) text: str = Field( - title="Contents of the chat message.", + ..., + title="Text", + description="Contents of the chat message", + ) + citations: list[Citation] = Field( + [], + title="Citations", + description="Citations for the chat messae.", ) - citations: List[Citation] = Field( - title="Citations for the chat message.", default=[] + documents: list[Document] = Field( + [], + title="Documents", + description="Documents used to generate grounded response with citations", ) - documents: List[Document] = Field( - title="Documents used to generate grounded response with citations.", - default=[], + search_results: list[dict[str, Any]] = Field( + [], + title="Search Results", + description="Search results used to generate grounded response with citations", ) - search_results: List[Dict[str, Any]] = Field( - title="Search results used to generate grounded response with citations.", - default=[], + search_queries: list[SearchQuery] = Field( + [], + title="Search Queries", + description="List of generated search queries", ) - search_queries: List[SearchQuery] = Field( - title="List of generated search queries.", - default=[], + tool_calls: list[ToolCall] = Field( + [], + title="Tool Calls", + description="List of tool calls generated for custom tools", ) - tool_calls: List[ToolCall] = Field( - title="List of tool calls generated for custom tools", - default=[], + finish_reason: Optional[str] = Field( + None, + title="Finish Reason", + description="Reson why the model finished the request", ) - finish_reason: str | None = (Field(default=None),) - chat_history: List[ChatMessage] | None = Field( - default=None, - title="A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.", + chat_history: Optional[list[ChatMessage]] = Field( + None, + title="Chat History", + description="A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.", ) - error: str | None = Field( - title="Error message if the response is an error.", - default=None, + error: Optional[str] = Field( + None, + title="Error", + description="Error message if the response is an error", ) class NonStreamedChatResponse(ChatResponse): - response_id: str | None = Field( - title="Unique identifier for the response.", - ) - generation_id: str | None = Field( - title="Unique identifier for the generation.", - ) - chat_history: List[ChatMessage] | None = Field( - title="A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", + """Non streamed chat response""" + response_id: Optional[str] = Field( + None, + title="Response ID", + description="Unique identifier for the response", + ) + generation_id: Optional[str] = Field( + None, + title="Generation ID", + description="Unique identifier for the generation", + ) + chat_history: Optional[list[ChatMessage]] = Field( + None, + title="Chat History", + description="A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", ) finish_reason: str = Field( - title="Reason the chat stream ended.", + ..., + title="Finish Reason", + description="Reason the chat stream ended", ) text: str = Field( - title="Contents of the chat message.", + ..., + title="Text", + description="Contents of the chat message", ) - citations: List[Citation] | None = Field( - title="Citations for the chat message.", - default=[], + citations: list[Citation] | None = Field( + [], + title="Citations", + description="Citations for the chat message", ) - documents: List[Document] | None = Field( - title="Documents used to generate grounded response with citations.", - default=[], + documents: list[Document] | None = Field( + [], + title="Documents", + description="Documents used to generate grounded response with citations", ) - search_results: List[Dict[str, Any]] | None = Field( - title="Search results used to generate grounded response with citations.", - default=[], + search_results: list[dict[str, Any]] | None = Field( + [], + title="Search Results", + description="Search results used to generate grounded response with citations", ) - search_queries: List[SearchQuery] | None = Field( - title="List of generated search queries.", - default=[], + search_queries: list[SearchQuery] | None = Field( + [], + title="Search Queries", + description="List of generated search queries.", ) - conversation_id: str | None = Field( - title="To store a conversation then create a conversation id and use it for every related request.", + conversation_id: Optional[str] = Field( + None, + title="Conversation ID", + description="To store a conversation then create a conversation id and use it for every related request", ) - tool_calls: List[ToolCall] | None = Field( - title="List of tool calls generated for custom tools", - default=[], + tool_calls: list[ToolCall] | None = Field( + [], + title="Tool Calls", + description="List of tool calls generated for custom tools", ) - error: str | None = Field( - title="Error message if the response is an error.", - default=None, + error: Optional[str] = Field( + None, + title="Error", + description="Error message if the response is an error", ) class StreamToolCallsChunk(ChatResponse): + """Stream tool call chunk generated event""" event_type: ClassVar[StreamEvent] = StreamEvent.TOOL_CALLS_CHUNK - - tool_call_delta: ToolCallDelta | None = Field( - title="Partial tool call", - default=ToolCallDelta( + tool_call_delta: Optional[ToolCallDelta] = Field( + ToolCallDelta( name=None, index=None, parameters=None, ), + title="Tool Call Delta", + description="Partial tool call", ) - - text: str | None = Field( - title="Contents of the chat message.", + text: Optional[str] = Field( + None, + title="Text", + description="Contents of the chat message", ) @@ -298,30 +405,44 @@ class StreamToolCallsChunk(ChatResponse): class ChatResponseEvent(BaseModel): + """ + Chat Response Event + """ event: StreamEvent = Field( - title="type of stream event", + ..., + title="Event", + description="Type of stream event", ) - data: StreamEventType = Field( - title="Data returned from chat response of a given event type", + ..., + title="Data", + description="Data returned from chat response of a given event type", ) class BaseChatRequest(BaseModel): + """ + Base Chat Request + """ message: str = Field( - title="The message to send to the chatbot.", + ..., + title="Message", + description="The message to send to the chatbot", ) - chat_history: List[ChatMessage] | None = Field( - default=None, - title="A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.", + chat_history: list[ChatMessage] | None = Field( + None, + title="Chat History", + description="A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.", ) conversation_id: str = Field( default_factory=lambda: str(uuid4()), - title="To store a conversation then create a conversation id and use it for every related request", + title="Conversation ID", + description="To store a conversation then create a conversation id and use it for every related request", ) - tools: List[Tool] | None = Field( + tools: Optional[list[Tool]] = Field( default_factory=list, - title=""" + title="Tools", + description=""" List of custom or managed tools to use for the response. If passing in managed tools, you only need to provide the name of the tool. If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. diff --git a/src/backend/schemas/citation.py b/src/backend/schemas/citation.py index 9d3a70d4a8..84fecbb363 100644 --- a/src/backend/schemas/citation.py +++ b/src/backend/schemas/citation.py @@ -1,17 +1,30 @@ -from typing import List - -from pydantic import BaseModel - - -class CitationBase(BaseModel): - pass +from pydantic import BaseModel, Field class Citation(BaseModel): - text: str - start: int - end: int - document_ids: List[str] + """ + Schema for a citation + """ + text: str = Field( + ..., + title="Text", + description="Citation text", + ) + start: int = Field( + ..., + title="Start", + description="Start position for the citation", + ) + end: int = Field( + ..., + title="End", + description="End position for the citation", + ) + document_ids: list[str] = Field( + ..., + title="Document IDs", + description="Documents used for the citation", + ) class Config: from_attributes = True diff --git a/src/backend/schemas/cohere_chat.py b/src/backend/schemas/cohere_chat.py index ba9bd83402..9db217f1b2 100644 --- a/src/backend/schemas/cohere_chat.py +++ b/src/backend/schemas/cohere_chat.py @@ -1,5 +1,5 @@ from enum import StrEnum -from typing import Any, Dict, List +from typing import Any, Optional from pydantic import Field @@ -8,7 +8,6 @@ class CohereChatPromptTruncation(StrEnum): """Dictates how the prompt will be constructed. Defaults to "AUTO_PRESERVE_ORDER".""" - OFF = "OFF" AUTO_PRESERVE_ORDER = "AUTO_PRESERVE_ORDER" @@ -18,10 +17,10 @@ class CohereChatRequest(BaseChatRequest): Request shape for Cohere Python SDK Streamed Chat. See: https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L1629 """ - - documents: List[Dict[str, Any]] = Field( + documents: list[dict[str, Any]] = Field( default_factory=list, - title="""Documents to use to generate grounded response with citations. Example: + title="Documents", + description="""Documents to use to generate grounded response with citations. Example: documents=[ { "id": "national_geographic_everest", @@ -38,78 +37,94 @@ class CohereChatRequest(BaseChatRequest): ] """, ) - model: str | None = Field( - default="command-r-plus", - title="The model to use for generating the response.", + model: Optional[str] = Field( + "command-r-plus", + title="Model", + description="The model to use for generating the response.", ) - temperature: float | None = Field( - default=None, - title="A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.", + temperature: Optional[float] = Field( + None, + title="Temperature", + description="A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.", ge=0, ) - k: int | None = Field( - default=None, - title="Ensures only the top k most likely tokens are considered for generation at each step.", + k: Optional[int] = Field( + None, + title="Top-K", + description="Ensures only the top k most likely tokens are considered for generation at each step.", le=500, ge=0, ) - p: float | None = Field( - default=None, - title="Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k.", + p: Optional[float] = Field( + None, + title="Top-P", + description="Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k.", le=0.99, ge=0, ) - preamble: str | None = Field( - default=None, - title="A string to override the preamble.", + preamble: Optional[str] = Field( + None, + title="Preamble", + description="A string to override the preamble.", ) - file_ids: List[str] | None = Field( - default=None, - title="List of File IDs for PDFs used in RAG for the response.", + file_ids: Optional[list[str]] = Field( + None, + title="File IDs", + description="List of File IDs for PDFs used in RAG for the response.", exclude=True, ) - search_queries_only: bool | None = Field( - default=False, - title="When set to true a list of search queries are generated. No search will occur nor replies to the user's message.", + search_queries_only: Optional[bool] = Field( + False, + title="Search Queries Only", + description="When set to true a list of search queries are generated. No search will occur nor replies to the user's message.", ) - max_tokens: int | None = Field( - default=None, - title="The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.", + max_tokens: Optional[int] = Field( + None, + title="Max Tokens", + description="The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.", ge=1, ) - seed: float | None = Field( - default=None, - title="If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.", + seed: Optional[float] = Field( + None, + title="Seed", + description="If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.", ) - stop_sequences: List[str] | None = Field( - default=None, - title="A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.", + stop_sequences: Optional[list[str]] = Field( + None, + title="Stop Sequences", + description="A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.", ) - presence_penalty: float | None = Field( - default=None, - title="Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.", + presence_penalty: Optional[float] = Field( + None, + title="Presence Penalty", + description="Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.", ge=0, le=1, ) - frequency_penalty: float | None = Field( - default=None, - title="Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.", + frequency_penalty: Optional[float] = Field( + None, + title="Frequency Penalty", + description="Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.", ge=0, le=1, ) - prompt_truncation: CohereChatPromptTruncation = Field( - default=CohereChatPromptTruncation.AUTO_PRESERVE_ORDER, - title="Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", - ) - tool_results: List[Dict[str, Any]] | None = Field( - default=None, - title="A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations.", - ) - force_single_step: bool | None = Field( - default=None, - title="If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message.", - ) - agent_id: str | None = Field( - default=None, - title="The agent ID to use for the chat.", + prompt_truncation: Optional[CohereChatPromptTruncation] = Field( + CohereChatPromptTruncation.AUTO_PRESERVE_ORDER, + title="Prompt Truncation", + description="Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", + ) + tool_results: Optional[list[dict[str, Any]]] = Field( + None, + title="Tool Results", + description="A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations.", + ) + force_single_step: Optional[bool] = Field( + None, + title="Force Single Step", + description="If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message.", + ) + agent_id: Optional[str] = Field( + None, + title="Agent ID", + description="The agent ID to use for the chat.", ) diff --git a/src/backend/schemas/context.py b/src/backend/schemas/context.py index 19365e62a8..6faaa3ec93 100644 --- a/src/backend/schemas/context.py +++ b/src/backend/schemas/context.py @@ -13,6 +13,9 @@ class Context(BaseModel): + """ + Context for a request + """ request: Optional[dict] = {} response: Optional[dict] = {} receive: Optional[dict] = {} diff --git a/src/backend/schemas/conversation.py b/src/backend/schemas/conversation.py index ec76f9768a..5cb29db5d1 100644 --- a/src/backend/schemas/conversation.py +++ b/src/backend/schemas/conversation.py @@ -1,5 +1,6 @@ import datetime -from typing import List, Optional +from abc import ABC +from typing import Optional from pydantic import BaseModel, Field, computed_field @@ -7,22 +8,72 @@ from backend.schemas.message import Message -class ConversationBase(BaseModel): - user_id: str - organization_id: Optional[str] = None +class ConversationBase(ABC, BaseModel): + """ + Abstract class for Conversation Schemas + """ + user_id: str = Field( + ..., + title="User ID", + description="User ID for the conversation", + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Organization ID for the conversation", + ) class Conversation(ConversationBase): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - title: str - messages: List[Message] - files: List[ConversationFilePublic] - description: Optional[str] - agent_id: Optional[str] - is_pinned: bool + """ + Schema for a conversation + """ + id: str = Field( + ..., + title="ID", + description="Unique identifier for the conversation", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When the conversation was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When the conversation was updated", + ) + + title: str = Field( + ..., + title="Title", + description="Title of the conversation", + ) + messages: list[Message] = Field( + ..., + title="Messages", + description="The conversation messages", + ) + files: list[ConversationFilePublic] = Field( + ..., + title="Files", + description="List of files for the conversation", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the conversation", + ) + agent_id: Optional[str] = Field( + None, + title="Agent ID", + description="Unique identifier for the agent used in the conversation", + ) + is_pinned: bool = Field( + ..., + title="Is Pinned", + description="If conversation is pinned", + ) @computed_field(return_type=int) def total_file_size(self): @@ -33,30 +84,80 @@ class Config: class ConversationPublic(Conversation): - user_id: Optional[str] = Field(exclude=True) - organization_id: Optional[str] = Field(exclude=True) + """ + A public conversation which removes the User ID and Organization ID + """ + user_id: Optional[str] = Field( + exclude=True, + title="User ID", + description="User ID for the conversation", + ) + organization_id: Optional[str] = Field( + exclude=True, + title="Organization ID", + description="Organization ID for the conversation", + ) class ConversationWithoutMessages(ConversationPublic): - messages: List[Message] = Field(exclude=True) + """ + A public conversation without messages attached + """ + messages: list[Message] = Field( + exclude=True, + title="Messages", + description="The conversation messages", + ) class UpdateConversationRequest(BaseModel): - title: Optional[str] = None - description: Optional[str] = None + """ + Request to update a conversation + """ + title: Optional[str] = Field( + None, + title="Title", + description="Title of the conversation", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the conversation", + ) class Config: from_attributes = True class ToggleConversationPinRequest(BaseModel): - is_pinned: bool + """ + Request to toggle pinning a conversation + """ + is_pinned: bool = Field( + ..., + title="Is Pinned", + description="If conversation is pinned", + ) class DeleteConversationResponse(BaseModel): + """ + Response for deleting a conversation + """ pass class GenerateTitleResponse(BaseModel): - title: str - error: Optional[str] = None + """ + Response for generating a title + """ + title: str = Field( + ..., + title="Title", + description="Title generated for the conversation", + ) + error: Optional[str] = Field( + None, + title="Error", + description="Error message if the response is an error", + ) diff --git a/src/backend/schemas/deployment.py b/src/backend/schemas/deployment.py index eada765c3f..1944e241d3 100644 --- a/src/backend/schemas/deployment.py +++ b/src/backend/schemas/deployment.py @@ -1,45 +1,52 @@ -from typing import Dict, List, Optional +from typing import Optional from pydantic import BaseModel, Field -from backend.schemas.model import ModelSimple - - -class DeploymentSimple(BaseModel): - id: str - name: str - deployment_class_name: Optional[str] = Field(exclude=True, default="") - env_vars: Optional[List[str]] - is_available: bool - is_community: bool - - class Config: - from_attributes = True - - -class DeploymentWithModels(BaseModel): - id: Optional[str] = None - name: str - description: Optional[str] = None - deployment_class_name: Optional[str] = Field(exclude=True, default="") - env_vars: Optional[List[str]] - is_available: bool = False - is_community: Optional[bool] = False - models: list[ModelSimple] - - class Config: - from_attributes = True - class DeploymentDefinition(BaseModel): - id: str - name: str - description: Optional[str] = None - config: Dict[str, str] = {} - is_available: bool = False - is_community: bool = False - models: list[str] - class_name: str + """ + Deployment Definition + """ + id: str = Field( + ..., + title="ID", + description="Unique Identifier for the Deployment", + ) + name: str = Field( + ..., + title="Name", + description="Name of the Deployment", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the deployment", + ) + config: dict[str, str] = Field( + {}, + title="Config", + description="Config for the deployment", + ) + is_available: bool = Field( + False, + title="Is Available", + description="Is deployment is available", + ) + is_community: Optional[bool] = Field( + False, + title="Is Community", + description="Is the deployment from the commmunity", + ) + models: list[str] = Field( + ..., + title="Models", + description="List of models for the deployment", + ) + class_name: str = Field( + ..., + title="Class Name", + description="Deployment class name", + ) class Config: from_attributes = True @@ -60,25 +67,85 @@ def from_db_deployment(cls, obj): class DeploymentCreate(BaseModel): - id: Optional[str] = None - name: str - description: Optional[str] = None - deployment_class_name: str - is_community: bool = False - default_deployment_config: Dict[str, str] + """ + Deployment Create Schema + """ + id: Optional[str] = Field( + None, + title="ID", + description="Unique Identifier for the Deployment", + ) + name: str = Field( + ..., + title="Name", + description="Name of the Deployment", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the deployment", + ) + deployment_class_name: str = Field( + ..., + title="Deployment Class Name", + description="Deployment Class Name", + ) + is_community: bool = Field( + False, + title="Is Community", + description="Is the deployment from the commmunity", + ) + default_deployment_config: dict[str, str] = Field( + ..., + title="Default Deployment Config", + description="The default deployment configuration", + ) class DeploymentUpdate(BaseModel): - name: Optional[str] = None - description: Optional[str] = None - deployment_class_name: Optional[str] = None - is_community: Optional[bool] = None - default_deployment_config: Optional[Dict[str, str]] = None + """ + Deployment Update Schema + """ + name: Optional[str] = Field( + None, + title="Name", + description="Name of the Deployment", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the deployment", + ) + deployment_class_name: Optional[str] = Field( + None, + title="Deployment Class Name", + description="Deployment Class Name", + ) + is_community: Optional[bool] = Field( + None, + title="Is Community", + description="Is the deployment from the commmunity", + ) + default_deployment_config: Optional[dict[str, str]] = Field( + None, + title="Default Deployment Config", + description="The default deployment configuration", + ) class DeleteDeployment(BaseModel): + """ + Delete Deployment Response + """ pass class UpdateDeploymentEnv(BaseModel): - env_vars: dict[str, str] + """ + Request to update Deployment Environment Variables + """ + env_vars: dict[str, str] = Field( + ..., + title="Env Vars", + description="Environment Variables for the Deployment", + ) diff --git a/src/backend/schemas/document.py b/src/backend/schemas/document.py index 0e81ea81a6..a6c6331b24 100644 --- a/src/backend/schemas/document.py +++ b/src/backend/schemas/document.py @@ -1,20 +1,43 @@ -from typing import Union +from typing import Optional -from pydantic import BaseModel - - -class DocumentBase(BaseModel): - pass +from pydantic import BaseModel, Field class Document(BaseModel): - text: str - document_id: str + """ + Schema for a Document + """ + text: str = Field( + ..., + title="Text", + description="Document text", + ) + document_id: str = Field( + ..., + title="Document_Id", + description="Unique Identifier for the document", + ) - title: Union[str, None] - url: Union[str, None] - fields: Union[dict, None] - tool_name: Union[str, None] + title: Optional[str] = Field( + None, + title="Title", + description="Document title", + ) + url: Optional[str] = Field( + None, + title="URL", + description="Document URL", + ) + fields: Optional[dict] = Field( + None, + title="Fields", + description="Document Fields", + ) + tool_name: Optional[str] = Field( + None, + title="Tool Name", + description="Tool name for the document", + ) class Config: from_attributes = True diff --git a/src/backend/schemas/file.py b/src/backend/schemas/file.py index affd632be6..baacea4e1e 100644 --- a/src/backend/schemas/file.py +++ b/src/backend/schemas/file.py @@ -1,68 +1,131 @@ import datetime +from abc import ABC from typing import Optional from pydantic import BaseModel, Field -class File(BaseModel): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - user_id: str - conversation_id: Optional[str] = "" - file_content: Optional[str] = "" - file_name: str - file_size: int = Field(default=0, ge=0) +class FileBase(ABC, BaseModel): + """ + Abstract class for File schemas + """ + id: str = Field( + ..., + title="ID", + description="Unique identifier of the file", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When file was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When file was updated", + ) + file_name: str = Field( + ..., + title="File Name", + description="Name of the file", + ) + file_size: int = Field( + 0, + title="File Size", + description="Size of the file in bytes", + ge=0 + ) + + + +class File(FileBase): + """ + Schema for a File + """ + user_id: str = Field( + ..., + title="User ID", + description="Unique identifier for who created the file", + ) + conversation_id: Optional[str] = Field( + "", + title="Conversation ID", + description="Unique identifier for the conversation the file is associated to", + ) + file_content: Optional[str] = Field( + "", + title="File Content", + description="The contents of the file", + ) class Config: from_attributes = True -class ConversationFilePublic(BaseModel): - id: str - user_id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - conversation_id: str - file_name: str - file_size: int = Field(default=0, ge=0) - - -class AgentFilePublic(BaseModel): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime - - file_name: str - file_size: int = Field(default=0, ge=0) +class ConversationFilePublic(FileBase): + """ + Schema for a public conversation file + """ + user_id: str = Field( + ..., + title="User ID", + description="Unique identifier for who created the file", + ) + conversation_id: str = Field( + ..., + title="Conversation ID", + description="Unique identifier for the conversation the file is associated to", + ) + + +class AgentFilePublic(FileBase): + """ + Schema for a public agent file + """ + pass -class FileMetadata(BaseModel): - id: str - file_name: str - file_content: str - file_size: int = Field(default=0, ge=0) - created_at: datetime.datetime - updated_at: datetime.datetime +class FileMetadata(FileBase): + """ + Schema for file metadata + """ + file_content: str = Field( + ..., + title="File Content", + description="The contents of the file", + ) class ListConversationFile(ConversationFilePublic): + """ + Listing conversation files + """ pass class UploadConversationFileResponse(ConversationFilePublic): + """ + Response for uploading a conversation file + """ pass class UploadAgentFileResponse(AgentFilePublic): + """ + Reponse for uploading an agent file + """ pass class DeleteConversationFileResponse(BaseModel): + """ + Response for deleting a conversation file + """ pass class DeleteAgentFileResponse(BaseModel): + """ + Response for deleting an agent file + """ pass diff --git a/src/backend/schemas/message.py b/src/backend/schemas/message.py index bc22cd3e1c..3478da9592 100644 --- a/src/backend/schemas/message.py +++ b/src/backend/schemas/message.py @@ -1,7 +1,8 @@ import datetime -from typing import List, Optional, Union +from abc import ABC +from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field from backend.database_models.message import MessageAgent from backend.schemas.citation import Citation @@ -10,35 +11,104 @@ from backend.schemas.tool import ToolCall -class MessageBase(BaseModel): - text: str +class MessageBase(ABC, BaseModel): + """ + Abstract class for Message schemas + """ + text: str = Field( + ..., + title="Text", + description="The text content of the message", + ) class Message(MessageBase): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime + """ + Message Schema + """ + id: str = Field( + ..., + title="ID", + description="Unique identifier of the message", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When message was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When message was updated", + ) - generation_id: Union[str, None] + generation_id: Optional[str] = Field( + None, + title="Generation ID", + description="Generation ID for the message", + ) - position: int - is_active: bool + position: int = Field( + ..., + title="Position", + description="Position in the conversation", + ) + is_active: bool = Field( + ..., + title="Is Active", + description="Is the message active", + ) - documents: List[Document] - citations: List[Citation] - files: List[ConversationFilePublic] - tool_calls: List[ToolCall] - tool_plan: Union[str, None] + documents: list[Document] = Field( + ..., + title="Documents", + description="Documents associated with the message", + ) + citations: list[Citation] = Field( + ..., + title="Citations", + description="Citations associated with the message", + ) + files: list[ConversationFilePublic] = Field( + ..., + title="Files", + description="Files associated with the message", + ) + tool_calls: list[ToolCall] = Field( + ..., + title="Tool Calls", + description="Tool calls associated with the message", + ) + tool_plan: Optional[str] = Field( + None, + title="Tool Plan", + description="Tool plan associated with the message", + ) - agent: MessageAgent + agent: MessageAgent = Field( + ..., + title="Agent", + description="Agent associated with the message", + ) class Config: from_attributes = True class UpdateMessage(BaseModel): - text: Optional[str] = None - title: Optional[str] = None + """ + Request to update a message + """ + text: Optional[str] = Field( + None, + title="Text", + description="The text content of the message", + ) + title: Optional[str] = Field( + None, + title="Title", + description="The title of the message", + ) class Config: from_attributes = True diff --git a/src/backend/schemas/model.py b/src/backend/schemas/model.py index b19d923ab3..728189d0cc 100644 --- a/src/backend/schemas/model.py +++ b/src/backend/schemas/model.py @@ -1,43 +1,69 @@ +from abc import ABC from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field -class Model(BaseModel): - id: str - name: str - deployment_id: str - cohere_name: Optional[str] - description: Optional[str] +class BaseModelSchema(ABC, BaseModel): + """ + Abstract class for Model Schemas + """ + name: str = Field( + ..., + title="Name", + description="Model name", + ) + cohere_name: Optional[str] = Field( + None, + title="Cohere Name", + description="Cohere model name", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Model description", + ) + + +class Model(BaseModelSchema): + id: str = Field( + ..., + title="ID", + description="Unique identifier for the model" + ) + deployment_id: str = Field( + ..., + title="Deployment ID", + description="Unique identifier for the deployment" + ) class Config: from_attributes = True -class ModelCreate(BaseModel): - name: str - cohere_name: Optional[str] - description: Optional[str] - deployment_id: str +class ModelCreate(BaseModelSchema): + deployment_id: str = Field( + ..., + title="Deployment ID", + description="Unique identifier for the deployment" + ) -class ModelUpdate(BaseModel): - name: Optional[str] = None - cohere_name: Optional[str] = None - description: Optional[str] = None - deployment_id: Optional[str] = None +class ModelUpdate(BaseModelSchema): + name: Optional[str] = Field( + None, + title="Name", + description="Model name", + ) + deployment_id: Optional[str] = Field( + None, + title="Deployment ID", + description="Unique identifier for the deployment" + ) class DeleteModel(BaseModel): + """ + Response for deleting a model + """ pass - - -class ModelSimple(BaseModel): - id: str - name: str - cohere_name: Optional[str] - description: Optional[str] - - class Config: - from_attributes = True - use_enum_values = True diff --git a/src/backend/schemas/organization.py b/src/backend/schemas/organization.py index 1dd1e46449..74842e978e 100644 --- a/src/backend/schemas/organization.py +++ b/src/backend/schemas/organization.py @@ -1,29 +1,65 @@ import datetime +from abc import ABC from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field -class OrganizationBase(BaseModel): - name: str +class OrganizationBase(ABC, BaseModel): + """ + Abstract class for organization schemas + """ + name: str = Field( + ..., + title="Name", + description="Name of the organization", + ) class Organization(OrganizationBase): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime + """ + Schema for an organization + """ + id: str = Field( + ..., + title="ID", + description="Unique identifier of the organization", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When organization was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When organization was updated", + ) class Config: from_attributes = True class CreateOrganization(OrganizationBase): + """ + Request to create an organization + """ pass class UpdateOrganization(OrganizationBase): - name: Optional[str] + """ + Request to update an organization + """ + name: Optional[str] = Field( + None, + title="Name", + description="Name of the organization", + ) class DeleteOrganization(BaseModel): + """ + Response when deleting organization + """ pass diff --git a/src/backend/schemas/params/__init__.py b/src/backend/schemas/params/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/backend/schemas/params/agent.py b/src/backend/schemas/params/agent.py new file mode 100644 index 0000000000..8a3ce7832f --- /dev/null +++ b/src/backend/schemas/params/agent.py @@ -0,0 +1,28 @@ +""" +Query and Path Parameters for Agents +""" +from typing import Annotated, Optional + +from fastapi import Path, Query + +from backend.schemas.agent import AgentVisibility + +VisibilityQueryParam = Annotated[AgentVisibility, Query( + title="Visibility", + description="Agent visibility", +)] + +AgentIdQueryParam = Annotated[Optional[str], Query( + title="Agent ID", + description="Agent ID to filter results by", +)] + +AgentIdPathParam = Annotated[str, Path( + title="Agent ID", + description="Agent ID for agent in question", +)] + +AgentToolMetadataIdPathParam = Annotated[str, Path( + title="Agent Tool Metadata ID", + description="Agent Tool Metadata ID for tool metadata in question", +)] diff --git a/src/backend/schemas/params/auth.py b/src/backend/schemas/params/auth.py new file mode 100644 index 0000000000..db902772b5 --- /dev/null +++ b/src/backend/schemas/params/auth.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Auth +""" +from typing import Annotated, Optional + +from fastapi import Path, Query + +StrategyPathParam = Annotated[str, Path( + title="Strategy Name", + description="Name of strategy in question", +)] + +CodeQueryParam = Annotated[Optional[str], Query( + title="Code", + description="OAuth Code", +)] diff --git a/src/backend/schemas/params/conversation.py b/src/backend/schemas/params/conversation.py new file mode 100644 index 0000000000..c07817c224 --- /dev/null +++ b/src/backend/schemas/params/conversation.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Conversations +""" +from typing import Annotated + +from fastapi import Path, Query + +ConversationIdPathParam = Annotated[str, Path( + title="Conversation ID", + description="Conversation ID for conversation in question", +)] + +QueryQueryParam = Annotated[str, Query( + title="Query", + description="Query string to search for in a conversation title", +)] diff --git a/src/backend/schemas/params/deployment.py b/src/backend/schemas/params/deployment.py new file mode 100644 index 0000000000..a530f97668 --- /dev/null +++ b/src/backend/schemas/params/deployment.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Deployments +""" +from typing import Annotated, Optional + +from fastapi import Path, Query + +DeploymentIdPathParam = Annotated[str, Path( + title="Deployment ID", + description="Deployment ID for deployment in question", +)] + +AllQueryParam = Annotated[Optional[bool], Query( + title="All", + description="Include all deployments, regardless of availability.", +)] diff --git a/src/backend/schemas/params/file.py b/src/backend/schemas/params/file.py new file mode 100644 index 0000000000..bbd879a02c --- /dev/null +++ b/src/backend/schemas/params/file.py @@ -0,0 +1,11 @@ +""" +Query and Path Parameters for Files +""" +from typing import Annotated + +from fastapi import Path + +FileIdPathParam = Annotated[str, Path( + title="File ID", + description="File ID for file in question", +)] diff --git a/src/backend/schemas/params/message.py b/src/backend/schemas/params/message.py new file mode 100644 index 0000000000..bf20801cdd --- /dev/null +++ b/src/backend/schemas/params/message.py @@ -0,0 +1,11 @@ +""" +Query and Path Parameters for Messages +""" +from typing import Annotated + +from fastapi import Path + +MessageIdPathParam = Annotated[str, Path( + title="Message ID", + description="Message ID for message in question", +)] diff --git a/src/backend/schemas/params/model.py b/src/backend/schemas/params/model.py new file mode 100644 index 0000000000..c6d6563b57 --- /dev/null +++ b/src/backend/schemas/params/model.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Models +""" +from typing import Annotated, Optional + +from fastapi import Path, Query + +ModelIdPathParam = Annotated[str, Path( + title="Model ID", + description="Model ID for the model in question", +)] + +ModelQueryParam = Annotated[Optional[str], Query( + title="Model", + description="Model to filter results by", +)] diff --git a/src/backend/schemas/params/organization.py b/src/backend/schemas/params/organization.py new file mode 100644 index 0000000000..0a06738e40 --- /dev/null +++ b/src/backend/schemas/params/organization.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Organizations +""" +from typing import Annotated, Optional + +from fastapi import Path, Query + +OrganizationIdPathParam = Annotated[str, Path( + title="Organization ID", + description="Organization ID for the organization in question", +)] + +OrganizationIdQueryParam = Annotated[Optional[str], Query( + title="Organization ID", + description="Organization ID to filter results by", +)] diff --git a/src/backend/schemas/params/scim.py b/src/backend/schemas/params/scim.py new file mode 100644 index 0000000000..d2f5ac9917 --- /dev/null +++ b/src/backend/schemas/params/scim.py @@ -0,0 +1,44 @@ +""" +Query and Path Parameters for SCIM +""" +from typing import Annotated, Optional + +from fastapi import Depends, Path, Query + + +class _ScimPaginationParams: + """ + Common pagination query parameters + """ + def __init__( + self, + start_index: Annotated[int, Query( + title="Start Index", + description="Start Index for request", + )] = 1, + count: Annotated[int, Query( + title="Count", + description="Maximum number of records to return per request", + )] = 100, + filter: Annotated[Optional[str], Query( + title="Filter", + description="Filter to use when filtering response", + )] = None + ) -> None: + self.start_index = start_index + self.count = count + self.filter = filter + +ScimPaginationQueryParams = Annotated[_ScimPaginationParams, Depends()] + + +UserIdPathParam = Annotated[str, Path( + title="User ID", + description="User ID for the user in question", +)] + + +GroupIdPathParam = Annotated[str, Path( + title="Group ID", + description="Group ID for the group in question", +)] diff --git a/src/backend/schemas/params/shared.py b/src/backend/schemas/params/shared.py new file mode 100644 index 0000000000..dcc061e38d --- /dev/null +++ b/src/backend/schemas/params/shared.py @@ -0,0 +1,33 @@ +""" +Shared Query and Path Parameters for Routers +""" +from typing import Annotated, Optional + +from fastapi import Depends, Query + + +class _PaginationParams: + """ + Common pagination query parameters + """ + def __init__( + self, + offset: Annotated[int, Query( + title="Pagination Offset", + description="Offset for where request should start returning records from", + )] = 0, + limit: Annotated[int, Query( + title="Pagination Limit", + description="Maximum number of records to return per request", + )] = 100, + ) -> None: + self.offset = offset + self.limit = limit + +PaginationQueryParams = Annotated[_PaginationParams, Depends()] + + +OrderByQueryParam = Annotated[Optional[str], Query( + title="Orber By", + description="Field to sorts results by", +)] diff --git a/src/backend/schemas/params/snapshot.py b/src/backend/schemas/params/snapshot.py new file mode 100644 index 0000000000..6b33ed56cb --- /dev/null +++ b/src/backend/schemas/params/snapshot.py @@ -0,0 +1,16 @@ +""" +Query and Path Parameters for Snapshots +""" +from typing import Annotated + +from fastapi import Path + +LinkIdPathParam = Annotated[str, Path( + title="Link ID", + description="Link ID for the snapshot link in question", +)] + +SnapshotIdPathParam = Annotated[str, Path( + title="Snapshot ID", + description="Snapshot ID for the snapshot in question", +)] diff --git a/src/backend/schemas/params/tool.py b/src/backend/schemas/params/tool.py new file mode 100644 index 0000000000..07f41cc38b --- /dev/null +++ b/src/backend/schemas/params/tool.py @@ -0,0 +1,11 @@ +""" +Query and Path Parameters for Auth +""" +from typing import Annotated + +from fastapi import Path + +ToolIdPathParam = Annotated[str, Path( + title="Tool ID", + description="Tool ID for tool in question", +)] diff --git a/src/backend/schemas/params/user.py b/src/backend/schemas/params/user.py new file mode 100644 index 0000000000..aa4cb5c9e1 --- /dev/null +++ b/src/backend/schemas/params/user.py @@ -0,0 +1,11 @@ +""" +Query and Path Parameters for Users +""" +from typing import Annotated + +from fastapi import Path + +UserIdPathParam = Annotated[str, Path( + title="User ID", + description="User ID for the user in question", +)] diff --git a/src/backend/schemas/scim.py b/src/backend/schemas/scim.py index 00f1846caf..0023da0492 100644 --- a/src/backend/schemas/scim.py +++ b/src/backend/schemas/scim.py @@ -1,4 +1,5 @@ -from typing import ClassVar, Dict, List, Optional, Union +from abc import ABC +from typing import ClassVar, Optional from pydantic import BaseModel, ConfigDict, Field from pydantic.alias_generators import to_camel @@ -7,7 +8,10 @@ from backend.database_models import User as DBUser -class BaseSchema(BaseModel): +class BaseSchema(ABC, BaseModel): + """ + Abstract class for other schemas + """ model_config = ConfigDict( alias_generator=to_camel, populate_by_name=True, @@ -16,32 +20,87 @@ class BaseSchema(BaseModel): class Meta(BaseSchema): - resource_type: str - created: str - last_modified: str + """ + Schema for metadata + """ + resource_type: str = Field( + ..., + title="Resource Type", + description="Type of resource the metadata is for", + ) + created: str = Field( + ..., + title="Created", + description="When metadata was created", + ) + last_modified: str = Field( + ..., + title="Last Modified", + description="When metadata was last modified", + ) class Name(BaseSchema): - given_name: str - family_name: str + given_name: str = Field( + ..., + title="Given Name", + description="User's given name", + ) + family_name: str = Field( + ..., + title="Family Name", + description="User's family name", + ) class BaseUser(BaseSchema): - user_name: Optional[str] - active: Optional[bool] + user_name: Optional[str] = Field( + None, + title="User Name", + description="User name", + ) + active: Optional[bool] = Field( + None, + title="Active", + description="Is user active", + ) - schemas: list[str] + schemas: list[str] = Field( + ..., + title="Schemas", + description="Schemas for the user", + ) class GroupMember(BaseSchema): - value: str - display: str + value: str = Field( + ..., + title="Value", + description="Value", + ) + display: str = Field( + ..., + title="Display", + description="Display", + ) class BaseGroup(BaseSchema): - schemas: list[str] - members: list[GroupMember] - display_name: str + schemas: list[str] = Field( + ..., + title="Schemas", + description="Schemas for the group", + ) + members: list[GroupMember] = Field( + ..., + title="Members", + description="Members of the group", + ) + display_name: str = Field( + ..., + title="Display Name", + description="Display name for the group", + ) class CreateGroup(BaseGroup): @@ -49,47 +108,127 @@ class CreateGroup(BaseGroup): class Email(BaseSchema): - primary: bool - value: Optional[str] = None - type: str + primary: bool = Field( + ..., + title="Primary", + description="Is email the primary email", + ) + value: Optional[str] = Field( + None, + title="Value", + description="Email value", + ) + type: str = Field( + ..., + title="Type", + description="Type of email", + ) class CreateUser(BaseUser): - name: Name - emails: List[Email] - externalId: str + name: Name = Field( + ..., + title="Name", + description="Name of user", + ) + emails: list[Email] = Field( + ..., + title="Emails", + description="List of emails for user", + ) + externalId: str = Field( + ..., + title="External ID", + description="External ID for the user", + ) class UpdateUser(BaseUser): - emails: List[Email] - name: Name + name: Name = Field( + ..., + title="Name", + description="Name of user", + ) + emails: list[Email] = Field( + ..., + title="Emails", + description="List of emails for user", + ) class Operation(BaseSchema): - op: str - value: dict[str, bool] + op: str = Field( + ..., + title="Op", + description="Op", + ) + value: dict[str, bool] = Field( + ..., + title="Value", + description="Value", + ) class GroupOperation(BaseSchema): - op: str - path: Optional[str] = None - value: Union[Dict[str, str], list[Dict[str, str]]] + op: str = Field( + ..., + title="Op", + description="Op", + ) + path: Optional[str] = Field( + None, + title="Path", + description="Path", + ) + value: dict[str, str]|list[dict[str, str]] = Field( + ..., + title="Value", + description="Value", + ) class PatchUser(BaseSchema): - schemas: list[str] - Operations: list[Operation] + schemas: list[str] = Field( + ..., + title="Schemas", + description="Schemas for user", + ) + Operations: list[Operation] = Field( + ..., + title="Operations", + description="Operations for the user", + ) class PatchGroup(BaseSchema): - schemas: list[str] - Operations: list[GroupOperation] + schemas: list[str] = Field( + ..., + title="Schemas", + description="Schemas for group", + ) + Operations: list[GroupOperation] = Field( + ..., + title="Operations", + description="Operations for the group", + ) class Group(BaseGroup): - id: str - display_name: str - meta: Meta + id: str = Field( + ..., + title="ID", + description="Unique identifier for the group", + ) + display_name: str = Field( + ..., + title="Display Name", + description="Display name for the group", + ) + meta: Meta = Field( + ..., + title="Meta", + description="Metadata for the group", + ) @staticmethod def from_db_group(db_group: DBGroup) -> "Group": @@ -110,9 +249,21 @@ def from_db_group(db_group: DBGroup) -> "Group": class User(BaseUser): - id: str - external_id: str - meta: Meta + id: str = Field( + ..., + title="ID", + description="Unique identifier for the user", + ) + external_id: str = Field( + ..., + title="External ID", + description="External ID for the user", + ) + meta: Meta = Field( + ..., + title="Meta", + description="Metadata for the user", + ) @staticmethod def from_db_user(db_user: DBUser) -> "User": @@ -134,14 +285,36 @@ class BaseListResponse(BaseSchema): schemas: ClassVar[list[str]] = [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ] - total_results: int - start_index: int - items_per_page: int + total_results: int = Field( + ..., + title="Total Results", + description="Total results available", + ) + start_index: int = Field( + ..., + title="Start Index", + description="Start index for returned results", + ) + items_per_page: int = Field( + ..., + title="Items Per Page", + description="Total results returned in the request", + ) class ListUserResponse(BaseListResponse): - resources: list[User] = Field(alias='Resources') + resources: list[User] = Field( + ..., + title="Resources", + description="List of Users", + alias="Resources", + ) class ListGroupResponse(BaseListResponse): - resources: list[Group] = Field(alias='Resources') + resources: list[Group] = Field( + ..., + title="Resources", + description="List of Groups", + alias="Resources", + ) diff --git a/src/backend/schemas/search_query.py b/src/backend/schemas/search_query.py index 47465d0220..570939c67c 100644 --- a/src/backend/schemas/search_query.py +++ b/src/backend/schemas/search_query.py @@ -1,13 +1,20 @@ -from pydantic import BaseModel - - -class SearchQueryBase(BaseModel): - pass +from pydantic import BaseModel, Field class SearchQuery(BaseModel): - text: str - generation_id: str + """ + Schema for search query + """ + text: str = Field( + ..., + title="Text", + description="Text for the search", + ) + generation_id: str = Field( + ..., + title="Generation ID", + description="Unique identifier for the generation", + ) class Config: from_attributes = True diff --git a/src/backend/schemas/snapshot.py b/src/backend/schemas/snapshot.py index c3e504999f..5245036f53 100644 --- a/src/backend/schemas/snapshot.py +++ b/src/backend/schemas/snapshot.py @@ -1,5 +1,5 @@ import datetime -from typing import Optional, Union +from typing import Optional from pydantic import BaseModel, Field @@ -8,100 +8,265 @@ class SnapshotAgent(BaseModel): - id: str - name: str - description: Optional[str] - preamble: Optional[str] - tools_metadata: Optional[list[AgentToolMetadata]] + """ + Agent Snapshot + """ + id: str = Field( + ..., + title="ID", + description="Unique identifier for the agent snapshot", + ) + name: str = Field( + ..., + title="Name", + description="Name of the snapshot", + ) + description: Optional[str] = Field( + None, + title="Description", + description="Description of the snapshot", + ) + preamble: Optional[str] = Field( + None, + title="Preamble", + description="Peamble for the snapshot", + ) + tools_metadata: Optional[list[AgentToolMetadata]] = Field( + None, + title="Tools Metadata", + description="Tools metadata for the snapshot", + ) class Config: from_attributes = True class SnapshotData(BaseModel): - title: str - description: str - messages: list[Message] - agent: Optional[SnapshotAgent] = Field(exclude=True) + """ + Snapshot data + """ + title: str = Field( + ..., + title="Title", + description="Title of the snapshot", + ) + description: str = Field( + ..., + title="Description", + description="Description of the snapshot", + ) + messages: list[Message] = Field( + ..., + title="Messages", + description="List of messages", + ) + agent: Optional[SnapshotAgent] = Field( + None, + title="Agent", + description="Agent for the snapshot", + exclude=True, + ) class Config: from_attributes = True class Snapshot(BaseModel): - conversation_id: str - id: str - last_message_id: str - user_id: str - organization_id: Union[str, None] - - version: int - created_at: datetime.datetime - updated_at: datetime.datetime - snapshot: SnapshotData - agent_id: Optional[str] = Field(exclude=True) + """ + Snapshot + """ + conversation_id: str = Field( + ..., + title="Conversation ID", + description="Unique identifier for the conversation", + ) + id: str = Field( + ..., + title="ID", + description="Unique identifier for the snapshot", + ) + last_message_id: str = Field( + ..., + title="Last Message ID", + description="Unique identifier for the last message", + ) + user_id: str = Field( + ..., + title="User ID", + description="Unique identifier for the user", + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Unique identifier for the organization", + ) + + version: int = Field( + ..., + title="Version", + description="Snapshot version", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When snapshot was creted", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When snapshot was updated", + ) + snapshot: SnapshotData = Field( + ..., + title="Snapshot Data", + description="Data for the snapshot", + ) + agent_id: Optional[str] = Field( + None, + title="Agent ID", + description="Unique identifier for the agent", + exclude=True, + ) class Config: from_attributes = True class SnapshotPublic(Snapshot): - user_id: Optional[str] = Field(exclude=True) - organization_id: Optional[str] = Field(exclude=True) + """ + Public snapshot + """ + user_id: Optional[str] = Field( + None, + title="User ID", + description="Unique identifier for the user", + exclude=True, + ) + organization_id: Optional[str] = Field( + None, + title="Organization ID", + description="Unique identifier for the organization", + exclude=True, + ) class Config: from_attributes = True class SnapshotLink(BaseModel): - snapshot_id: str - user_id: str + """ + Snapshot link + """ + snapshot_id: str = Field( + ..., + title="Snapshot ID", + description="Unique identifier for the snapshot", + ) + user_id: str = Field( + ..., + title="User ID", + description="Unique identifier for the user", + ) class Config: from_attributes = True class SnapshotLinkPublic(SnapshotLink): - user_id: Optional[str] = Field(exclude=True) + """ + Public snapshot link + """ + user_id: Optional[str] = Field( + None, + title="User ID", + description="Unique identifier for the user", + exclude=True, + ) class Config: from_attributes = True class SnapshotAccess(BaseModel): - user_id: str - snapshot_id: str - link_id: str + """ + Snapshot access + """ + user_id: str = Field( + ..., + title="User ID", + description="Unique identifier for the user", + ) + snapshot_id: str = Field( + ..., + title="Snapshot ID", + description="Unique identifier for the snapshot", + ) + link_id: str = Field( + ..., + title="Link ID", + description="Unique identifier for the link", + ) class Config: from_attributes = True class SnapshotWithLinks(SnapshotPublic): - links: list[str] + """ + Snapshot with links + """ + links: list[str] = Field( + ..., + title="Links", + description="List of links", + ) class Config: from_attributes = True class CreateSnapshotRequest(BaseModel): - conversation_id: str + """ + Request to create a snapshot + """ + conversation_id: str = Field( + ..., + title="Conversation ID", + description="Unique identifier for the conversation", + ) class Config: from_attributes = True class CreateSnapshotResponse(SnapshotLinkPublic): - link_id: str - messages: list[Message] + """ + Response for creating a snapshot + """ + link_id: str = Field( + ..., + title="Link ID", + description="Unique identifier for the link", + ) + messages: list[Message] = Field( + ..., + title="Messages", + description="List of messages", + ) class Config: from_attributes = True class DeleteSnapshotLinkResponse(BaseModel): + """ + Response for deleting a snapshot link + """ pass class DeleteSnapshotResponse(BaseModel): + """ + Response for deleting a snapshot + """ pass diff --git a/src/backend/schemas/tool.py b/src/backend/schemas/tool.py index c3ce846f5a..b805e518d8 100644 --- a/src/backend/schemas/tool.py +++ b/src/backend/schemas/tool.py @@ -5,6 +5,9 @@ class ToolCategory(StrEnum): + """ + Supported Tool Categories + """ DataLoader = "Data loader" FileLoader = "File loader" Function = "Function" @@ -12,42 +15,136 @@ class ToolCategory(StrEnum): class Tool(BaseModel): - name: Optional[str] = "" - parameter_definitions: Optional[dict] = {} + """ + Tool Schema + """ + name: Optional[str] = Field( + "", + title="Name", + description="Name of the Tool", + ) + parameter_definitions: Optional[dict] = Field( + {}, + title="Parameter Definitions", + description="Parameters definitions for the tool", + ) class ToolDefinition(Tool): - display_name: str = "" - description: str = "" - error_message: Optional[str] = "" - kwargs: dict = {} - is_visible: bool = False - is_available: bool = False - category: ToolCategory = ToolCategory.DataLoader - - is_auth_required: bool = False # Per user - auth_url: Optional[str] = "" # Per user - token: Optional[str] = "" # Per user - should_return_token: bool = False - - implementation: Any = Field(exclude=True) - auth_implementation: Any = Field(default=None, exclude=True) + """ + Tool Definition Schema + """ + display_name: str = Field( + "", + title="Display Name", + description="Display name for the tool", + ) + description: str = Field( + "", + title="Description", + description="Description of the tool", + ) + error_message: Optional[str] = Field( + "", + title="Error Message", + description="Error message", + ) + kwargs: dict = Field( + {}, + title="kwargs", + description="kwags for the tool", + ) + is_visible: bool = Field( + False, + title="Is Visible", + description="Is the tool visible", + ) + is_available: bool = Field( + False, + title="Is Available", + description="Is the tool available", + ) + category: ToolCategory = Field( + ToolCategory.DataLoader, + title="Category", + description="Tool category", + ) + + is_auth_required: bool = Field( + False, + title="Is Auth Required", + description="Is auth required for the tool", + ) # Per user + auth_url: Optional[str] = Field( + "", + title="Auth Url", + description="Auth url for the tool", + ) # Per user + token: Optional[str] = Field( + "", + title="Token", + description="Token for the tool", + ) # Per user + should_return_token: bool = Field( + False, + title="Should Return Token", + description="If the tool returns a token", + ) + + implementation: Any = Field( + ..., + title="Implementation", + description="Implementation for the tool", + exclude=True, + ) + auth_implementation: Optional[Any] = Field( + None, + title="Auth Implementation", + description="Auth implementation for the tool", + exclude=True, + ) class Config: from_attributes = True class ToolCall(BaseModel): - name: str - parameters: dict = {} + """ + Schema for Tool Call + """ + name: str = Field( + ..., + title="Name", + description="Name of the Tool", + ) + parameters: dict = Field( + {}, + title="Parameters", + description="Parameters for the tool call", + ) class Config: from_attributes = True class ToolCallDelta(BaseModel): - name: str | None - index: int | None - parameters: str | None + """ + Schema for Tool Call Delta + """ + name: Optional[str] = Field( + None, + title="Name", + description="Name of the Tool", + ) + index: Optional[int] = Field( + None, + title="Index", + description="Index", + ) + parameters: Optional[str] = Field( + None, + title="Parameters", + description="Parameters for the tool call", + ) class Config: from_attributes = True diff --git a/src/backend/schemas/tool_auth.py b/src/backend/schemas/tool_auth.py index 3dc7026bfa..eaf777782d 100644 --- a/src/backend/schemas/tool_auth.py +++ b/src/backend/schemas/tool_auth.py @@ -1,16 +1,43 @@ import datetime from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field class UpdateToolAuth(BaseModel): - user_id: Optional[str] = None - tool_id: Optional[str] = None - token_type: Optional[str] = None - encrypted_access_token: Optional[bytes] = None - encrypted_refresh_token: Optional[bytes] = None - expires_at: Optional[datetime.datetime] = None + """ + Schema for Tool Authentication + """ + user_id: Optional[str] = Field( + None, + title="User ID", + description="Unique identifier for the user", + ) + tool_id: Optional[str] = Field( + None, + title="Tool ID", + description="Unique identifier for the tool", + ) + token_type: Optional[str] = Field( + None, + title="Token Type", + description="Type of token", + ) + encrypted_access_token: Optional[bytes] = Field( + None, + title="Encrypted Access Token", + description="Token for authentication", + ) + encrypted_refresh_token: Optional[bytes] = Field( + None, + title="Encrypted Refresh Token", + description="The token that can be used to refresh the access token", + ) + expires_at: Optional[datetime.datetime] = Field( + None, + title="Expires At", + description="When the access token expires", + ) class Config: from_attributes = True @@ -18,4 +45,7 @@ class Config: class DeleteToolAuth(BaseModel): + """ + Response when deleting a tool auth + """ pass diff --git a/src/backend/schemas/user.py b/src/backend/schemas/user.py index b12afa108f..a002f9cb6f 100644 --- a/src/backend/schemas/user.py +++ b/src/backend/schemas/user.py @@ -1,7 +1,8 @@ import datetime +from abc import ABC from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Field from backend.services.auth import BasicAuthentication @@ -9,23 +10,60 @@ DEFAULT_USER_NAME = "Default User" -class UserBase(BaseModel): - fullname: str - email: Optional[str] = None +class UserBase(ABC, BaseModel): + """ + Abstract class for User Schemas + """ + fullname: str = Field( + ..., + title="Full Name", + description="User's Full Name", + ) + email: Optional[str] = Field( + None, + title="Email", + description="User's email address", + ) class User(UserBase): - id: str - created_at: datetime.datetime - updated_at: datetime.datetime + """ + User schema + """ + id: str = Field( + ..., + title="ID", + description="", + ) + created_at: datetime.datetime = Field( + ..., + title="Created At Timestamp", + description="When the user was created", + ) + updated_at: datetime.datetime = Field( + ..., + title="Updated At Timestamp", + description="When the user was updated", + ) class Config: from_attributes = True -class UserPassword(BaseModel): - password: Optional[str] = None - hashed_password: Optional[bytes] = None +class UserPassword(ABC, BaseModel): + """ + Adstract class for user schemas + """ + password: Optional[str] = Field( + None, + title="Password", + description="Password for the user", + ) + hashed_password: Optional[bytes] = Field( + None, + title="Hashed Password", + description="The user's password hashed", + ) def __init__(self, **data): password = data.pop("password", None) @@ -39,13 +77,30 @@ def __init__(self, **data): class CreateUser(UserBase, UserPassword): + """ + Request to create a user + """ pass class UpdateUser(UserPassword): - fullname: Optional[str] = None - email: Optional[str] = None + """ + Request to update a user + """ + fullname: Optional[str] = Field( + None, + title="Full Name", + description="User's Full Name", + ) + email: Optional[str] = Field( + None, + title="Email", + description="User's email address", + ) class DeleteUser(BaseModel): + """ + Response when deleting a user + """ pass diff --git a/src/interfaces/assistants_web/src/cohere-client/client.ts b/src/interfaces/assistants_web/src/cohere-client/client.ts index 4cfda9c342..4914469d29 100644 --- a/src/interfaces/assistants_web/src/cohere-client/client.ts +++ b/src/interfaces/assistants_web/src/cohere-client/client.ts @@ -61,7 +61,7 @@ export class CohereClient { conversationId: string; fileId: string; }) { - return this.cohereService.default.getFileV1ConversationsConversationIdFilesFileIdGet({ + return this.cohereService.conversation.getFileV1ConversationsConversationIdFilesFileIdGet({ conversationId, fileId, }); @@ -70,33 +70,35 @@ export class CohereClient { public batchUploadConversationFile( formData: Body_batch_upload_file_v1_conversations_batch_upload_file_post ) { - return this.cohereService.default.batchUploadFileV1ConversationsBatchUploadFilePost({ + return this.cohereService.conversation.batchUploadFileV1ConversationsBatchUploadFilePost({ formData, }); } public getAgentFile({ agentId, fileId }: { agentId: string; fileId: string }) { - return this.cohereService.default.getAgentFileV1AgentsAgentIdFilesFileIdGet({ + return this.cohereService.agent.getAgentFileV1AgentsAgentIdFilesFileIdGet({ agentId, fileId, }); } public batchUploadAgentFile(formData: Body_batch_upload_file_v1_agents_batch_upload_file_post) { - return this.cohereService.default.batchUploadFileV1AgentsBatchUploadFilePost({ + return this.cohereService.agent.batchUploadFileV1AgentsBatchUploadFilePost({ formData, }); } public deletefile({ conversationId, fileId }: { conversationId: string; fileId: string }) { - return this.cohereService.default.deleteFileV1ConversationsConversationIdFilesFileIdDelete({ - conversationId, - fileId, - }); + return this.cohereService.conversation.deleteFileV1ConversationsConversationIdFilesFileIdDelete( + { + conversationId, + fileId, + } + ); } public listFiles({ conversationId }: { conversationId: string }) { - return this.cohereService.default.listFilesV1ConversationsConversationIdFilesGet({ + return this.cohereService.conversation.listFilesV1ConversationsConversationIdFilesGet({ conversationId, }); } @@ -164,30 +166,30 @@ export class CohereClient { orderBy?: string; agentId?: string; }) { - return this.cohereService.default.listConversationsV1ConversationsGet(params); + return this.cohereService.conversation.listConversationsV1ConversationsGet(params); } public getConversation({ conversationId }: { conversationId: string }) { - return this.cohereService.default.getConversationV1ConversationsConversationIdGet({ + return this.cohereService.conversation.getConversationV1ConversationsConversationIdGet({ conversationId, }); } public deleteConversation({ conversationId }: { conversationId: string }) { - return this.cohereService.default.deleteConversationV1ConversationsConversationIdDelete({ + return this.cohereService.conversation.deleteConversationV1ConversationsConversationIdDelete({ conversationId, }); } public editConversation(requestBody: UpdateConversationRequest, conversationId: string) { - return this.cohereService.default.updateConversationV1ConversationsConversationIdPut({ + return this.cohereService.conversation.updateConversationV1ConversationsConversationIdPut({ conversationId: conversationId, requestBody, }); } public toggleConversationPin(requestBody: ToggleConversationPinRequest, conversationId: string) { - return this.cohereService.default.toggleConversationPinV1ConversationsConversationIdTogglePinPut( + return this.cohereService.conversation.toggleConversationPinV1ConversationsConversationIdTogglePinPut( { conversationId: conversationId, requestBody, @@ -196,7 +198,7 @@ export class CohereClient { } public async synthesizeMessage(conversationId: string, messageId: string) { - return this.cohereService.default.synthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGet( + return this.cohereService.conversation.synthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGet( { conversationId, messageId, @@ -205,30 +207,30 @@ export class CohereClient { } public async getExperimentalFeatures() { - return this.cohereService.default.listExperimentalFeaturesV1ExperimentalFeaturesGet(); + return this.cohereService.experimentalFeatures.listExperimentalFeaturesV1ExperimentalFeaturesGet(); } public listTools({ agentId }: { agentId?: string | null }) { - return this.cohereService.default.listToolsV1ToolsGet({ agentId }); + return this.cohereService.tool.listToolsV1ToolsGet({ agentId }); } public deleteAuthTool({ toolId }: { toolId: string }) { - return this.cohereService.default.deleteToolAuthV1ToolAuthToolIdDelete({ toolId }); + return this.cohereService.auth.deleteToolAuthV1ToolAuthToolIdDelete({ toolId }); } public listDeployments({ all }: { all?: boolean }) { - return this.cohereService.default.listDeploymentsV1DeploymentsGet({ all }); + return this.cohereService.deployment.listDeploymentsV1DeploymentsGet({ all }); } public updateDeploymentEnvVariables(requestBody: UpdateDeploymentEnv, deploymentId: string) { - return this.cohereService.default.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ + return this.cohereService.deployment.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ deploymentId: deploymentId, requestBody, }); } public login({ email, password }: { email: string; password: string }) { - return this.cohereService.default.loginV1LoginPost({ + return this.cohereService.auth.loginV1LoginPost({ requestBody: { strategy: 'Basic', payload: { email, password }, @@ -237,15 +239,15 @@ export class CohereClient { } public logout() { - return this.cohereService.default.logoutV1LogoutGet(); + return this.cohereService.auth.logoutV1LogoutGet(); } public getAuthStrategies() { - return this.cohereService.default.getStrategiesV1AuthStrategiesGet(); + return this.cohereService.auth.getStrategiesV1AuthStrategiesGet(); } public createUser(requestBody: CreateUserV1UsersPostData) { - return this.cohereService.default.createUserV1UsersPost(requestBody); + return this.cohereService.user.createUserV1UsersPost(requestBody); } public async googleSSOAuth({ code }: { code: string }) { @@ -304,56 +306,58 @@ export class CohereClient { } public getDefaultAgent() { - return this.cohereService.default.getAgentByIdV1AgentsAgentIdGet({ agentId: DEFAULT_AGENT_ID }); + return this.cohereService.agent.getAgentByIdV1AgentsAgentIdGet({ agentId: DEFAULT_AGENT_ID }); } public getAgent(agentId: string) { - return this.cohereService.default.getAgentByIdV1AgentsAgentIdGet({ agentId }); + return this.cohereService.agent.getAgentByIdV1AgentsAgentIdGet({ agentId }); } public createAgent(requestBody: CreateAgentRequest) { - return this.cohereService.default.createAgentV1AgentsPost({ requestBody }); + return this.cohereService.agent.createAgentV1AgentsPost({ requestBody }); } public listAgents({ offset, limit = 100 }: { offset?: number; limit?: number }) { - return this.cohereService.default.listAgentsV1AgentsGet({ offset, limit }); + return this.cohereService.agent.listAgentsV1AgentsGet({ offset, limit }); } public updateAgent(requestBody: UpdateAgentRequest, agentId: string) { - return this.cohereService.default.updateAgentV1AgentsAgentIdPut({ + return this.cohereService.agent.updateAgentV1AgentsAgentIdPut({ agentId: agentId, requestBody, }); } public deleteAgent(request: { agentId: string }) { - return this.cohereService.default.deleteAgentV1AgentsAgentIdDelete(request); + return this.cohereService.agent.deleteAgentV1AgentsAgentIdDelete(request); } public generateTitle({ conversationId }: { conversationId: string }) { - return this.cohereService.default.generateTitleV1ConversationsConversationIdGenerateTitlePost({ - conversationId, - }); + return this.cohereService.conversation.generateTitleV1ConversationsConversationIdGenerateTitlePost( + { + conversationId, + } + ); } public listSnapshots() { - return this.cohereService.default.listSnapshotsV1SnapshotsGet(); + return this.cohereService.snapshot.listSnapshotsV1SnapshotsGet(); } public createSnapshot(requestBody: CreateSnapshotRequest) { - return this.cohereService.default.createSnapshotV1SnapshotsPost({ requestBody }); + return this.cohereService.snapshot.createSnapshotV1SnapshotsPost({ requestBody }); } public getSnapshot({ linkId }: { linkId: string }) { - return this.cohereService.default.getSnapshotV1SnapshotsLinkLinkIdGet({ linkId }); + return this.cohereService.snapshot.getSnapshotV1SnapshotsLinkLinkIdGet({ linkId }); } public deleteSnapshotLink({ linkId }: { linkId: string }) { - return this.cohereService.default.deleteSnapshotLinkV1SnapshotsLinkLinkIdDelete({ linkId }); + return this.cohereService.snapshot.deleteSnapshotLinkV1SnapshotsLinkLinkIdDelete({ linkId }); } public deleteSnapshot({ snapshotId }: { snapshotId: string }) { - return this.cohereService.default.deleteSnapshotV1SnapshotsSnapshotIdDelete({ snapshotId }); + return this.cohereService.snapshot.deleteSnapshotV1SnapshotsSnapshotIdDelete({ snapshotId }); } private getEndpoint(endpoint: 'chat-stream' | 'google/auth' | 'oidc/auth') { diff --git a/src/interfaces/assistants_web/src/cohere-client/generated/CohereClientGenerated.ts b/src/interfaces/assistants_web/src/cohere-client/generated/CohereClientGenerated.ts index 12629cfe05..2babfefe9a 100644 --- a/src/interfaces/assistants_web/src/cohere-client/generated/CohereClientGenerated.ts +++ b/src/interfaces/assistants_web/src/cohere-client/generated/CohereClientGenerated.ts @@ -2,12 +2,36 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest'; import { FetchHttpRequest } from './core/FetchHttpRequest'; import type { OpenAPIConfig } from './core/OpenAPI'; import { Interceptors } from './core/OpenAPI'; +import { AgentService } from './services.gen'; +import { AuthService } from './services.gen'; +import { ChatService } from './services.gen'; +import { ConversationService } from './services.gen'; import { DefaultService } from './services.gen'; +import { DeploymentService } from './services.gen'; +import { ExperimentalFeaturesService } from './services.gen'; +import { ModelService } from './services.gen'; +import { OrganizationService } from './services.gen'; +import { ScimService } from './services.gen'; +import { SnapshotService } from './services.gen'; +import { ToolService } from './services.gen'; +import { UserService } from './services.gen'; type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; export class CohereClientGenerated { + public readonly agent: AgentService; + public readonly auth: AuthService; + public readonly chat: ChatService; + public readonly conversation: ConversationService; public readonly default: DefaultService; + public readonly deployment: DeploymentService; + public readonly experimentalFeatures: ExperimentalFeaturesService; + public readonly model: ModelService; + public readonly organization: OrganizationService; + public readonly scim: ScimService; + public readonly snapshot: SnapshotService; + public readonly tool: ToolService; + public readonly user: UserService; public readonly request: BaseHttpRequest; @@ -17,7 +41,7 @@ export class CohereClientGenerated { ) { this.request = new HttpRequest({ BASE: config?.BASE ?? '', - VERSION: config?.VERSION ?? '0.1.0', + VERSION: config?.VERSION ?? '1.1.5', WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false, CREDENTIALS: config?.CREDENTIALS ?? 'include', TOKEN: config?.TOKEN, @@ -31,6 +55,18 @@ export class CohereClientGenerated { }, }); + this.agent = new AgentService(this.request); + this.auth = new AuthService(this.request); + this.chat = new ChatService(this.request); + this.conversation = new ConversationService(this.request); this.default = new DefaultService(this.request); + this.deployment = new DeploymentService(this.request); + this.experimentalFeatures = new ExperimentalFeaturesService(this.request); + this.model = new ModelService(this.request); + this.organization = new OrganizationService(this.request); + this.scim = new ScimService(this.request); + this.snapshot = new SnapshotService(this.request); + this.tool = new ToolService(this.request); + this.user = new UserService(this.request); } } diff --git a/src/interfaces/assistants_web/src/cohere-client/generated/core/OpenAPI.ts b/src/interfaces/assistants_web/src/cohere-client/generated/core/OpenAPI.ts index be99f58378..85816ec430 100644 --- a/src/interfaces/assistants_web/src/cohere-client/generated/core/OpenAPI.ts +++ b/src/interfaces/assistants_web/src/cohere-client/generated/core/OpenAPI.ts @@ -47,7 +47,7 @@ export const OpenAPI: OpenAPIConfig = { PASSWORD: undefined, TOKEN: undefined, USERNAME: undefined, - VERSION: '0.1.0', + VERSION: '1.1.5', WITH_CREDENTIALS: false, interceptors: { request: new Interceptors(), diff --git a/src/interfaces/assistants_web/src/cohere-client/generated/schemas.gen.ts b/src/interfaces/assistants_web/src/cohere-client/generated/schemas.gen.ts index c69bcbd8bd..17b7d56694 100644 --- a/src/interfaces/assistants_web/src/cohere-client/generated/schemas.gen.ts +++ b/src/interfaces/assistants_web/src/cohere-client/generated/schemas.gen.ts @@ -4,29 +4,35 @@ export const $AgentPublic = { properties: { user_id: { type: 'string', - title: 'User Id', + title: 'User ID', + description: 'User ID for the Agent', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - version: { - type: 'integer', - title: 'Version', + title: 'Updated At Timestamp', + description: 'When the agent was updated', }, name: { type: 'string', title: 'Name', + description: 'Name of the Agent', + }, + version: { + type: 'integer', + title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -38,6 +44,7 @@ export const $AgentPublic = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -49,10 +56,12 @@ export const $AgentPublic = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { type: 'number', title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -67,6 +76,7 @@ export const $AgentPublic = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, tools_metadata: { anyOf: [ @@ -81,6 +91,7 @@ export const $AgentPublic = { }, ], title: 'Tools Metadata', + description: 'List of tool metadata for the Agent', }, deployment: { anyOf: [ @@ -92,6 +103,7 @@ export const $AgentPublic = { }, ], title: 'Deployment', + description: 'Deployment for the Agent', }, model: { anyOf: [ @@ -103,6 +115,7 @@ export const $AgentPublic = { }, ], title: 'Model', + description: 'Model for the Agent', }, is_private: { anyOf: [ @@ -114,42 +127,33 @@ export const $AgentPublic = { }, ], title: 'Is Private', + description: 'If the Agent is private', }, }, type: 'object', - required: [ - 'user_id', - 'id', - 'created_at', - 'updated_at', - 'version', - 'name', - 'description', - 'preamble', - 'temperature', - 'tools', - 'deployment', - 'model', - 'is_private', - ], + required: ['user_id', 'id', 'created_at', 'updated_at', 'name', 'version', 'temperature'], title: 'AgentPublic', + description: 'Public agent schema', } as const; export const $AgentToolMetadata = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent tool metadata ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent tool metadata was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the agent tool metadata was updated', }, user_id: { anyOf: [ @@ -160,15 +164,18 @@ export const $AgentToolMetadata = { type: 'null', }, ], - title: 'User Id', + title: 'User ID', + description: 'User ID for the agent tool metadata', }, agent_id: { type: 'string', - title: 'Agent Id', + title: 'Agent ID', + description: 'Agent ID for the agent tool metadata', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -176,36 +183,43 @@ export const $AgentToolMetadata = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', - required: ['id', 'created_at', 'updated_at', 'user_id', 'agent_id', 'tool_name', 'artifacts'], + required: ['id', 'created_at', 'updated_at', 'agent_id', 'tool_name', 'artifacts'], title: 'AgentToolMetadata', + description: 'Agent tool metadata schema', } as const; export const $AgentToolMetadataPublic = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent tool metadata ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent tool metadata was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the agent tool metadata was updated', }, agent_id: { type: 'string', - title: 'Agent Id', + title: 'Agent ID', + description: 'Agent ID for the agent tool metadata', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -213,17 +227,20 @@ export const $AgentToolMetadataPublic = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', required: ['id', 'created_at', 'updated_at', 'agent_id', 'tool_name', 'artifacts'], title: 'AgentToolMetadataPublic', + description: 'Public agent tool metadata schema', } as const; export const $AgentVisibility = { type: 'string', enum: ['private', 'public', 'all'], title: 'AgentVisibility', + description: 'Supported values for Agent Visibility', } as const; export const $Body_batch_upload_file_v1_agents_batch_upload_file_post = { @@ -266,7 +283,7 @@ export const $ChatMessage = { properties: { role: { $ref: '#/components/schemas/ChatRole', - title: 'One of CHATBOT|USER|SYSTEM to identify who the message is coming from.', + title: 'Role', }, message: { anyOf: [ @@ -277,7 +294,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Message', + description: 'Contents of the chat message.', }, tool_plan: { anyOf: [ @@ -288,7 +306,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Contents of the tool plan.', + title: 'Tool Plan', + description: 'Contents of the tool plan.', }, tool_results: { anyOf: [ @@ -302,7 +321,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Results from the tool call.', + title: 'Tool Results', + description: 'Results from the tool call.', }, tool_calls: { anyOf: [ @@ -316,21 +336,23 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', }, }, type: 'object', required: ['role'], title: 'ChatMessage', - description: - "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", + description: `A list of previous messages between the user and the model, meant to give the mode +conversational context for responding to the user's message.`, } as const; export const $ChatResponseEvent = { properties: { event: { $ref: '#/components/schemas/StreamEvent', - title: 'type of stream event', + title: 'Event', + description: 'Type of stream event', }, data: { anyOf: [ @@ -371,12 +393,14 @@ export const $ChatResponseEvent = { $ref: '#/components/schemas/NonStreamedChatResponse', }, ], - title: 'Data returned from chat response of a given event type', + title: 'Data', + description: 'Data returned from chat response of a given event type', }, }, type: 'object', required: ['event', 'data'], title: 'ChatResponseEvent', + description: 'Chat Response Event', } as const; export const $ChatRole = { @@ -391,26 +415,31 @@ export const $Citation = { text: { type: 'string', title: 'Text', + description: 'Citation text', }, start: { type: 'integer', title: 'Start', + description: 'Start position for the citation', }, end: { type: 'integer', title: 'End', + description: 'End position for the citation', }, document_ids: { items: { type: 'string', }, type: 'array', - title: 'Document Ids', + title: 'Document IDs', + description: 'Documents used for the citation', }, }, type: 'object', required: ['text', 'start', 'end', 'document_ids'], title: 'Citation', + description: 'Schema for a citation', } as const; export const $CohereChatPromptTruncation = { @@ -424,7 +453,8 @@ export const $CohereChatRequest = { properties: { message: { type: 'string', - title: 'The message to send to the chatbot.', + title: 'Message', + description: 'The message to send to the chatbot', }, chat_history: { anyOf: [ @@ -438,12 +468,14 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Chat History', + description: 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', }, conversation_id: { type: 'string', - title: + title: 'Conversation ID', + description: 'To store a conversation then create a conversation id and use it for every related request', }, tools: { @@ -458,7 +490,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: ` + title: 'Tools', + description: ` List of custom or managed tools to use for the response. If passing in managed tools, you only need to provide the name of the tool. If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. @@ -515,7 +548,8 @@ export const $CohereChatRequest = { type: 'object', }, type: 'array', - title: `Documents to use to generate grounded response with citations. Example: + title: 'Documents', + description: `Documents to use to generate grounded response with citations. Example: documents=[ { "id": "national_geographic_everest", @@ -541,7 +575,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'The model to use for generating the response.', + title: 'Model', + description: 'The model to use for generating the response.', default: 'command-r-plus', }, temperature: { @@ -554,7 +589,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Temperature', + description: 'A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.', }, k: { @@ -568,7 +604,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Top-K', + description: 'Ensures only the top k most likely tokens are considered for generation at each step.', }, p: { @@ -582,7 +619,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Top-P', + description: 'Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k.', }, preamble: { @@ -594,7 +632,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'A string to override the preamble.', + title: 'Preamble', + description: 'A string to override the preamble.', }, file_ids: { anyOf: [ @@ -608,7 +647,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'List of File IDs for PDFs used in RAG for the response.', + title: 'File IDs', + description: 'List of File IDs for PDFs used in RAG for the response.', }, search_queries_only: { anyOf: [ @@ -619,7 +659,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Search Queries Only', + description: "When set to true a list of search queries are generated. No search will occur nor replies to the user's message.", default: false, }, @@ -633,7 +674,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Max Tokens', + description: 'The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.', }, seed: { @@ -645,7 +687,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Seed', + description: 'If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.', }, stop_sequences: { @@ -660,7 +703,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Stop Sequences', + description: 'A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.', }, presence_penalty: { @@ -674,7 +718,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Presence Penalty', + description: 'Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.', }, frequency_penalty: { @@ -688,12 +733,22 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Frequency Penalty', + description: 'Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.', }, prompt_truncation: { - $ref: '#/components/schemas/CohereChatPromptTruncation', - title: "Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", + anyOf: [ + { + $ref: '#/components/schemas/CohereChatPromptTruncation', + }, + { + type: 'null', + }, + ], + title: 'Prompt Truncation', + description: + "Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", default: 'AUTO_PRESERVE_ORDER', }, tool_results: { @@ -708,7 +763,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Tool Results', + description: 'A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations.', }, force_single_step: { @@ -720,7 +776,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Force Single Step', + description: 'If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message.', }, agent_id: { @@ -732,7 +789,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'The agent ID to use for the chat.', + title: 'Agent ID', + description: 'The agent ID to use for the chat.', }, }, type: 'object', @@ -746,61 +804,73 @@ export const $ConversationFilePublic = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'ConversationFilePublic', + description: 'Schema for a public conversation file', } as const; export const $ConversationPublic = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the conversation', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the conversation was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the conversation was updated', }, title: { type: 'string', title: 'Title', + description: 'Title of the conversation', }, messages: { items: { @@ -808,6 +878,7 @@ export const $ConversationPublic = { }, type: 'array', title: 'Messages', + description: 'The conversation messages', }, files: { items: { @@ -815,6 +886,7 @@ export const $ConversationPublic = { }, type: 'array', title: 'Files', + description: 'List of files for the conversation', }, description: { anyOf: [ @@ -826,6 +898,7 @@ export const $ConversationPublic = { }, ], title: 'Description', + description: 'Description of the conversation', }, agent_id: { anyOf: [ @@ -836,11 +909,13 @@ export const $ConversationPublic = { type: 'null', }, ], - title: 'Agent Id', + title: 'Agent ID', + description: 'Unique identifier for the agent used in the conversation', }, is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, total_file_size: { type: 'integer', @@ -856,33 +931,36 @@ export const $ConversationPublic = { 'title', 'messages', 'files', - 'description', - 'agent_id', 'is_pinned', 'total_file_size', ], title: 'ConversationPublic', + description: 'A public conversation which removes the User ID and Organization ID', } as const; export const $ConversationWithoutMessages = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the conversation', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the conversation was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the conversation was updated', }, title: { type: 'string', title: 'Title', + description: 'Title of the conversation', }, files: { items: { @@ -890,6 +968,7 @@ export const $ConversationWithoutMessages = { }, type: 'array', title: 'Files', + description: 'List of files for the conversation', }, description: { anyOf: [ @@ -901,6 +980,7 @@ export const $ConversationWithoutMessages = { }, ], title: 'Description', + description: 'Description of the conversation', }, agent_id: { anyOf: [ @@ -911,11 +991,13 @@ export const $ConversationWithoutMessages = { type: 'null', }, ], - title: 'Agent Id', + title: 'Agent ID', + description: 'Unique identifier for the agent used in the conversation', }, is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, total_file_size: { type: 'integer', @@ -924,18 +1006,9 @@ export const $ConversationWithoutMessages = { }, }, type: 'object', - required: [ - 'id', - 'created_at', - 'updated_at', - 'title', - 'files', - 'description', - 'agent_id', - 'is_pinned', - 'total_file_size', - ], + required: ['id', 'created_at', 'updated_at', 'title', 'files', 'is_pinned', 'total_file_size'], title: 'ConversationWithoutMessages', + description: 'A public conversation without messages attached', } as const; export const $CreateAgentRequest = { @@ -943,6 +1016,7 @@ export const $CreateAgentRequest = { name: { type: 'string', title: 'Name', + description: 'Name of the Agent', }, version: { anyOf: [ @@ -954,6 +1028,7 @@ export const $CreateAgentRequest = { }, ], title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -965,6 +1040,7 @@ export const $CreateAgentRequest = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -976,6 +1052,7 @@ export const $CreateAgentRequest = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { anyOf: [ @@ -987,6 +1064,7 @@ export const $CreateAgentRequest = { }, ], title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -1001,6 +1079,7 @@ export const $CreateAgentRequest = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, tools_metadata: { anyOf: [ @@ -1015,6 +1094,12 @@ export const $CreateAgentRequest = { }, ], title: 'Tools Metadata', + description: 'Tools metadata for the Agent', + }, + deployment: { + type: 'string', + title: 'Deployment', + description: 'Deployment for the Agent', }, deployment_config: { anyOf: [ @@ -1029,14 +1114,12 @@ export const $CreateAgentRequest = { }, ], title: 'Deployment Config', + description: 'Deployment config for the Agent', }, model: { type: 'string', title: 'Model', - }, - deployment: { - type: 'string', - title: 'Deployment', + description: 'Model for the Agent', }, organization_id: { anyOf: [ @@ -1047,7 +1130,8 @@ export const $CreateAgentRequest = { type: 'null', }, ], - title: 'Organization Id', + title: 'Organization ID', + description: 'Organization ID for the Agent', }, is_private: { anyOf: [ @@ -1059,12 +1143,14 @@ export const $CreateAgentRequest = { }, ], title: 'Is Private', + description: 'If the Agent is private', default: false, }, }, type: 'object', - required: ['name', 'model', 'deployment'], + required: ['name', 'deployment', 'model'], title: 'CreateAgentRequest', + description: 'Schema to create an agent', } as const; export const $CreateAgentToolMetadataRequest = { @@ -1078,11 +1164,13 @@ export const $CreateAgentToolMetadataRequest = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Agent Tool Metadata ID', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -1090,11 +1178,13 @@ export const $CreateAgentToolMetadataRequest = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', required: ['tool_name', 'artifacts'], title: 'CreateAgentToolMetadataRequest', + description: 'Request to create Agent Tool Metadata', } as const; export const $CreateGroup = { @@ -1105,6 +1195,7 @@ export const $CreateGroup = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the group', }, members: { items: { @@ -1112,10 +1203,12 @@ export const $CreateGroup = { }, type: 'array', title: 'Members', + description: 'Members of the group', }, displayName: { type: 'string', - title: 'Displayname', + title: 'Display Name', + description: 'Display name for the group', }, }, type: 'object', @@ -1128,34 +1221,40 @@ export const $CreateOrganization = { name: { type: 'string', title: 'Name', + description: 'Name of the organization', }, }, type: 'object', required: ['name'], title: 'CreateOrganization', + description: 'Request to create an organization', } as const; export const $CreateSnapshotRequest = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, }, type: 'object', required: ['conversation_id'], title: 'CreateSnapshotRequest', + description: 'Request to create a snapshot', } as const; export const $CreateSnapshotResponse = { properties: { snapshot_id: { type: 'string', - title: 'Snapshot Id', + title: 'Snapshot ID', + description: 'Unique identifier for the snapshot', }, link_id: { type: 'string', - title: 'Link Id', + title: 'Link ID', + description: 'Unique identifier for the link', }, messages: { items: { @@ -1163,83 +1262,97 @@ export const $CreateSnapshotResponse = { }, type: 'array', title: 'Messages', + description: 'List of messages', }, }, type: 'object', required: ['snapshot_id', 'link_id', 'messages'], title: 'CreateSnapshotResponse', + description: 'Response for creating a snapshot', } as const; export const $DeleteAgent = { properties: {}, type: 'object', title: 'DeleteAgent', + description: 'Response for deleting an agent', } as const; export const $DeleteAgentFileResponse = { properties: {}, type: 'object', title: 'DeleteAgentFileResponse', + description: 'Response for deleting an agent file', } as const; export const $DeleteAgentToolMetadata = { properties: {}, type: 'object', title: 'DeleteAgentToolMetadata', + description: 'Delete agent tool metadata response', } as const; export const $DeleteConversationFileResponse = { properties: {}, type: 'object', title: 'DeleteConversationFileResponse', + description: 'Response for deleting a conversation file', } as const; export const $DeleteConversationResponse = { properties: {}, type: 'object', title: 'DeleteConversationResponse', + description: 'Response for deleting a conversation', } as const; export const $DeleteDeployment = { properties: {}, type: 'object', title: 'DeleteDeployment', + description: 'Delete Deployment Response', } as const; export const $DeleteModel = { properties: {}, type: 'object', title: 'DeleteModel', + description: 'Response for deleting a model', } as const; export const $DeleteOrganization = { properties: {}, type: 'object', title: 'DeleteOrganization', + description: 'Response when deleting organization', } as const; export const $DeleteSnapshotLinkResponse = { properties: {}, type: 'object', title: 'DeleteSnapshotLinkResponse', + description: 'Response for deleting a snapshot link', } as const; export const $DeleteSnapshotResponse = { properties: {}, type: 'object', title: 'DeleteSnapshotResponse', + description: 'Response for deleting a snapshot', } as const; export const $DeleteToolAuth = { properties: {}, type: 'object', title: 'DeleteToolAuth', + description: 'Response when deleting a tool auth', } as const; export const $DeleteUser = { properties: {}, type: 'object', title: 'DeleteUser', + description: 'Response when deleting a user', } as const; export const $DeploymentCreate = { @@ -1253,11 +1366,13 @@ export const $DeploymentCreate = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Unique Identifier for the Deployment', }, name: { type: 'string', title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1269,14 +1384,17 @@ export const $DeploymentCreate = { }, ], title: 'Description', + description: 'Description of the deployment', }, deployment_class_name: { type: 'string', title: 'Deployment Class Name', + description: 'Deployment Class Name', }, is_community: { type: 'boolean', title: 'Is Community', + description: 'Is the deployment from the commmunity', default: false, }, default_deployment_config: { @@ -1285,22 +1403,26 @@ export const $DeploymentCreate = { }, type: 'object', title: 'Default Deployment Config', + description: 'The default deployment configuration', }, }, type: 'object', required: ['name', 'deployment_class_name', 'default_deployment_config'], title: 'DeploymentCreate', + description: 'Deployment Create Schema', } as const; export const $DeploymentDefinition = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique Identifier for the Deployment', }, name: { type: 'string', title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1312,6 +1434,7 @@ export const $DeploymentDefinition = { }, ], title: 'Description', + description: 'Description of the deployment', }, config: { additionalProperties: { @@ -1319,16 +1442,26 @@ export const $DeploymentDefinition = { }, type: 'object', title: 'Config', + description: 'Config for the deployment', default: {}, }, is_available: { type: 'boolean', title: 'Is Available', + description: 'Is deployment is available', default: false, }, is_community: { - type: 'boolean', + anyOf: [ + { + type: 'boolean', + }, + { + type: 'null', + }, + ], title: 'Is Community', + description: 'Is the deployment from the commmunity', default: false, }, models: { @@ -1337,15 +1470,18 @@ export const $DeploymentDefinition = { }, type: 'array', title: 'Models', + description: 'List of models for the deployment', }, class_name: { type: 'string', title: 'Class Name', + description: 'Deployment class name', }, }, type: 'object', required: ['id', 'name', 'models', 'class_name'], title: 'DeploymentDefinition', + description: 'Deployment Definition', } as const; export const $DeploymentUpdate = { @@ -1360,6 +1496,7 @@ export const $DeploymentUpdate = { }, ], title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1371,6 +1508,7 @@ export const $DeploymentUpdate = { }, ], title: 'Description', + description: 'Description of the deployment', }, deployment_class_name: { anyOf: [ @@ -1382,6 +1520,7 @@ export const $DeploymentUpdate = { }, ], title: 'Deployment Class Name', + description: 'Deployment Class Name', }, is_community: { anyOf: [ @@ -1393,6 +1532,7 @@ export const $DeploymentUpdate = { }, ], title: 'Is Community', + description: 'Is the deployment from the commmunity', }, default_deployment_config: { anyOf: [ @@ -1407,10 +1547,12 @@ export const $DeploymentUpdate = { }, ], title: 'Default Deployment Config', + description: 'The default deployment configuration', }, }, type: 'object', title: 'DeploymentUpdate', + description: 'Deployment Update Schema', } as const; export const $Document = { @@ -1418,10 +1560,12 @@ export const $Document = { text: { type: 'string', title: 'Text', + description: 'Document text', }, document_id: { type: 'string', - title: 'Document Id', + title: 'Document_Id', + description: 'Unique Identifier for the document', }, title: { anyOf: [ @@ -1433,6 +1577,7 @@ export const $Document = { }, ], title: 'Title', + description: 'Document title', }, url: { anyOf: [ @@ -1443,7 +1588,8 @@ export const $Document = { type: 'null', }, ], - title: 'Url', + title: 'URL', + description: 'Document URL', }, fields: { anyOf: [ @@ -1455,6 +1601,7 @@ export const $Document = { }, ], title: 'Fields', + description: 'Document Fields', }, tool_name: { anyOf: [ @@ -1466,11 +1613,13 @@ export const $Document = { }, ], title: 'Tool Name', + description: 'Tool name for the document', }, }, type: 'object', - required: ['text', 'document_id', 'title', 'url', 'fields', 'tool_name'], + required: ['text', 'document_id'], title: 'Document', + description: 'Schema for a Document', } as const; export const $Email = { @@ -1478,6 +1627,7 @@ export const $Email = { primary: { type: 'boolean', title: 'Primary', + description: 'Is email the primary email', }, value: { anyOf: [ @@ -1489,10 +1639,12 @@ export const $Email = { }, ], title: 'Value', + description: 'Email value', }, type: { type: 'string', title: 'Type', + description: 'Type of email', }, }, type: 'object', @@ -1504,36 +1656,43 @@ export const $FileMetadata = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the file', }, - file_name: { + created_at: { type: 'string', - title: 'File Name', + format: 'date-time', + title: 'Created At Timestamp', + description: 'When file was created', }, - file_content: { + updated_at: { type: 'string', - title: 'File Content', + format: 'date-time', + title: 'Updated At Timestamp', + description: 'When file was updated', + }, + file_name: { + type: 'string', + title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, - created_at: { - type: 'string', - format: 'date-time', - title: 'Created At', - }, - updated_at: { + file_content: { type: 'string', - format: 'date-time', - title: 'Updated At', + title: 'File Content', + description: 'The contents of the file', }, }, type: 'object', - required: ['id', 'file_name', 'file_content', 'created_at', 'updated_at'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'file_content'], title: 'FileMetadata', + description: 'Schema for file metadata', } as const; export const $GenerateTitleResponse = { @@ -1541,6 +1700,7 @@ export const $GenerateTitleResponse = { title: { type: 'string', title: 'Title', + description: 'Title generated for the conversation', }, error: { anyOf: [ @@ -1552,11 +1712,13 @@ export const $GenerateTitleResponse = { }, ], title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', required: ['title'], title: 'GenerateTitleResponse', + description: 'Response for generating a title', } as const; export const $Group = { @@ -1567,6 +1729,7 @@ export const $Group = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the group', }, members: { items: { @@ -1574,17 +1737,21 @@ export const $Group = { }, type: 'array', title: 'Members', + description: 'Members of the group', }, displayName: { type: 'string', - title: 'Displayname', + title: 'Display Name', + description: 'Display name for the group', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the group', }, meta: { $ref: '#/components/schemas/Meta', + description: 'Metadata for the group', }, }, type: 'object', @@ -1597,10 +1764,12 @@ export const $GroupMember = { value: { type: 'string', title: 'Value', + description: 'Value', }, display: { type: 'string', title: 'Display', + description: 'Display', }, }, type: 'object', @@ -1613,6 +1782,7 @@ export const $GroupOperation = { op: { type: 'string', title: 'Op', + description: 'Op', }, path: { anyOf: [ @@ -1624,6 +1794,7 @@ export const $GroupOperation = { }, ], title: 'Path', + description: 'Path', }, value: { anyOf: [ @@ -1644,6 +1815,7 @@ export const $GroupOperation = { }, ], title: 'Value', + description: 'Value', }, }, type: 'object', @@ -1670,11 +1842,13 @@ export const $JWTResponse = { token: { type: 'string', title: 'Token', + description: 'JSON Web Token', }, }, type: 'object', required: ['token'], title: 'JWTResponse', + description: 'JWT Response', } as const; export const $ListAuthStrategy = { @@ -1682,6 +1856,7 @@ export const $ListAuthStrategy = { strategy: { type: 'string', title: 'Strategy', + description: 'Auth strategy name', }, client_id: { anyOf: [ @@ -1692,7 +1867,8 @@ export const $ListAuthStrategy = { type: 'null', }, ], - title: 'Client Id', + title: 'Client ID', + description: 'Client ID to be used', }, authorization_endpoint: { anyOf: [ @@ -1704,70 +1880,84 @@ export const $ListAuthStrategy = { }, ], title: 'Authorization Endpoint', + description: 'The endpoint for authorization', }, pkce_enabled: { type: 'boolean', - title: 'Pkce Enabled', + title: 'PKCE Enabled', + description: 'If PKCE is enabled', }, }, type: 'object', - required: ['strategy', 'client_id', 'authorization_endpoint', 'pkce_enabled'], + required: ['strategy', 'pkce_enabled'], title: 'ListAuthStrategy', + description: 'List Auth Strategy', } as const; export const $ListConversationFile = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'ListConversationFile', + description: 'Listing conversation files', } as const; export const $ListGroupResponse = { properties: { totalResults: { type: 'integer', - title: 'Totalresults', + title: 'Total Results', + description: 'Total results available', }, startIndex: { type: 'integer', - title: 'Startindex', + title: 'Start Index', + description: 'Start index for returned results', }, itemsPerPage: { type: 'integer', - title: 'Itemsperpage', + title: 'Items Per Page', + description: 'Total results returned in the request', }, Resources: { items: { @@ -1775,6 +1965,7 @@ export const $ListGroupResponse = { }, type: 'array', title: 'Resources', + description: 'List of Groups', }, }, type: 'object', @@ -1786,15 +1977,18 @@ export const $ListUserResponse = { properties: { totalResults: { type: 'integer', - title: 'Totalresults', + title: 'Total Results', + description: 'Total results available', }, startIndex: { type: 'integer', - title: 'Startindex', + title: 'Start Index', + description: 'Start index for returned results', }, itemsPerPage: { type: 'integer', - title: 'Itemsperpage', + title: 'Items Per Page', + description: 'Total results returned in the request', }, Resources: { items: { @@ -1802,6 +1996,7 @@ export const $ListUserResponse = { }, type: 'array', title: 'Resources', + description: 'List of Users', }, }, type: 'object', @@ -1814,6 +2009,7 @@ export const $Login = { strategy: { type: 'string', title: 'Strategy', + description: 'Auth strategy to use', }, payload: { anyOf: [ @@ -1828,17 +2024,20 @@ export const $Login = { }, ], title: 'Payload', + description: 'Login payload depending on strategy used', }, }, type: 'object', required: ['strategy'], title: 'Login', + description: 'Login Request', } as const; export const $Logout = { properties: {}, type: 'object', title: 'Logout', + description: 'Logout Request', } as const; export const $Message = { @@ -1846,20 +2045,24 @@ export const $Message = { text: { type: 'string', title: 'Text', + description: 'The text content of the message', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the message', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When message was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When message was updated', }, generation_id: { anyOf: [ @@ -1870,15 +2073,18 @@ export const $Message = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Generation ID for the message', }, position: { type: 'integer', title: 'Position', + description: 'Position in the conversation', }, is_active: { type: 'boolean', title: 'Is Active', + description: 'Is the message active', }, documents: { items: { @@ -1886,6 +2092,7 @@ export const $Message = { }, type: 'array', title: 'Documents', + description: 'Documents associated with the message', }, citations: { items: { @@ -1893,6 +2100,7 @@ export const $Message = { }, type: 'array', title: 'Citations', + description: 'Citations associated with the message', }, files: { items: { @@ -1900,6 +2108,7 @@ export const $Message = { }, type: 'array', title: 'Files', + description: 'Files associated with the message', }, tool_calls: { items: { @@ -1907,6 +2116,7 @@ export const $Message = { }, type: 'array', title: 'Tool Calls', + description: 'Tool calls associated with the message', }, tool_plan: { anyOf: [ @@ -1918,9 +2128,12 @@ export const $Message = { }, ], title: 'Tool Plan', + description: 'Tool plan associated with the message', }, agent: { $ref: '#/components/schemas/MessageAgent', + title: 'Agent', + description: 'Agent associated with the message', }, }, type: 'object', @@ -1929,17 +2142,16 @@ export const $Message = { 'id', 'created_at', 'updated_at', - 'generation_id', 'position', 'is_active', 'documents', 'citations', 'files', 'tool_calls', - 'tool_plan', 'agent', ], title: 'Message', + description: 'Message Schema', } as const; export const $MessageAgent = { @@ -1952,35 +2164,32 @@ export const $Meta = { properties: { resourceType: { type: 'string', - title: 'Resourcetype', + title: 'Resource Type', + description: 'Type of resource the metadata is for', }, created: { type: 'string', title: 'Created', + description: 'When metadata was created', }, lastModified: { type: 'string', - title: 'Lastmodified', + title: 'Last Modified', + description: 'When metadata was last modified', }, }, type: 'object', required: ['resourceType', 'created', 'lastModified'], title: 'Meta', + description: 'Schema for metadata', } as const; export const $Model = { properties: { - id: { - type: 'string', - title: 'Id', - }, name: { type: 'string', title: 'Name', - }, - deployment_id: { - type: 'string', - title: 'Deployment Id', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -1992,6 +2201,7 @@ export const $Model = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2003,10 +2213,21 @@ export const $Model = { }, ], title: 'Description', + description: 'Model description', + }, + id: { + type: 'string', + title: 'ID', + description: 'Unique identifier for the model', + }, + deployment_id: { + type: 'string', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', - required: ['id', 'name', 'deployment_id', 'cohere_name', 'description'], + required: ['name', 'id', 'deployment_id'], title: 'Model', } as const; @@ -2015,6 +2236,7 @@ export const $ModelCreate = { name: { type: 'string', title: 'Name', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -2026,6 +2248,7 @@ export const $ModelCreate = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2037,14 +2260,16 @@ export const $ModelCreate = { }, ], title: 'Description', + description: 'Model description', }, deployment_id: { type: 'string', - title: 'Deployment Id', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', - required: ['name', 'cohere_name', 'description', 'deployment_id'], + required: ['name', 'deployment_id'], title: 'ModelCreate', } as const; @@ -2060,6 +2285,7 @@ export const $ModelUpdate = { }, ], title: 'Name', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -2071,6 +2297,7 @@ export const $ModelUpdate = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2082,6 +2309,7 @@ export const $ModelUpdate = { }, ], title: 'Description', + description: 'Model description', }, deployment_id: { anyOf: [ @@ -2092,7 +2320,8 @@ export const $ModelUpdate = { type: 'null', }, ], - title: 'Deployment Id', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', @@ -2103,11 +2332,13 @@ export const $Name = { properties: { givenName: { type: 'string', - title: 'Givenname', + title: 'Given Name', + description: "User's given name", }, familyName: { type: 'string', - title: 'Familyname', + title: 'Family Name', + description: "User's family name", }, }, type: 'object', @@ -2126,7 +2357,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Unique identifier for the response.', + title: 'Response ID', + description: 'Unique identifier for the response', }, generation_id: { anyOf: [ @@ -2137,7 +2369,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Unique identifier for the generation.', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, chat_history: { anyOf: [ @@ -2151,16 +2384,19 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: + title: 'Chat History', + description: "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", }, finish_reason: { type: 'string', - title: 'Reason the chat stream ended.', + title: 'Finish Reason', + description: 'Reason the chat stream ended', }, text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, citations: { anyOf: [ @@ -2174,7 +2410,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat message', default: [], }, documents: { @@ -2189,7 +2426,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, search_results: { @@ -2204,7 +2442,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, search_queries: { @@ -2219,7 +2458,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'List of generated search queries.', + title: 'Search Queries', + description: 'List of generated search queries.', default: [], }, conversation_id: { @@ -2231,8 +2471,9 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: - 'To store a conversation then create a conversation id and use it for every related request.', + title: 'Conversation ID', + description: + 'To store a conversation then create a conversation id and use it for every related request', }, tool_calls: { anyOf: [ @@ -2246,7 +2487,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, error: { @@ -2258,19 +2500,14 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Error message if the response is an error.', + title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', - required: [ - 'response_id', - 'generation_id', - 'chat_history', - 'finish_reason', - 'text', - 'conversation_id', - ], + required: ['finish_reason', 'text'], title: 'NonStreamedChatResponse', + description: 'Non streamed chat response', } as const; export const $Operation = { @@ -2278,6 +2515,7 @@ export const $Operation = { op: { type: 'string', title: 'Op', + description: 'Op', }, value: { additionalProperties: { @@ -2285,6 +2523,7 @@ export const $Operation = { }, type: 'object', title: 'Value', + description: 'Value', }, }, type: 'object', @@ -2297,25 +2536,30 @@ export const $Organization = { name: { type: 'string', title: 'Name', + description: 'Name of the organization', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the organization', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When organization was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When organization was updated', }, }, type: 'object', required: ['name', 'id', 'created_at', 'updated_at'], title: 'Organization', + description: 'Schema for an organization', } as const; export const $PatchGroup = { @@ -2326,6 +2570,7 @@ export const $PatchGroup = { }, type: 'array', title: 'Schemas', + description: 'Schemas for group', }, operations: { items: { @@ -2333,6 +2578,7 @@ export const $PatchGroup = { }, type: 'array', title: 'Operations', + description: 'Operations for the group', }, }, type: 'object', @@ -2348,6 +2594,7 @@ export const $PatchUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for user', }, operations: { items: { @@ -2355,6 +2602,7 @@ export const $PatchUser = { }, type: 'array', title: 'Operations', + description: 'Operations for the user', }, }, type: 'object', @@ -2367,15 +2615,18 @@ export const $SearchQuery = { text: { type: 'string', title: 'Text', + description: 'Text for the search', }, generation_id: { type: 'string', - title: 'Generation Id', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, }, type: 'object', required: ['text', 'generation_id'], title: 'SearchQuery', + description: 'Schema for search query', } as const; export const $SnapshotData = { @@ -2383,10 +2634,12 @@ export const $SnapshotData = { title: { type: 'string', title: 'Title', + description: 'Title of the snapshot', }, description: { type: 'string', title: 'Description', + description: 'Description of the snapshot', }, messages: { items: { @@ -2394,43 +2647,53 @@ export const $SnapshotData = { }, type: 'array', title: 'Messages', + description: 'List of messages', }, }, type: 'object', required: ['title', 'description', 'messages'], title: 'SnapshotData', + description: 'Snapshot data', } as const; export const $SnapshotPublic = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the snapshot', }, last_message_id: { type: 'string', - title: 'Last Message Id', + title: 'Last Message ID', + description: 'Unique identifier for the last message', }, version: { type: 'integer', title: 'Version', + description: 'Snapshot version', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When snapshot was creted', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When snapshot was updated', }, snapshot: { $ref: '#/components/schemas/SnapshotData', + title: 'Snapshot Data', + description: 'Data for the snapshot', }, }, type: 'object', @@ -2444,38 +2707,47 @@ export const $SnapshotPublic = { 'snapshot', ], title: 'SnapshotPublic', + description: 'Public snapshot', } as const; export const $SnapshotWithLinks = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the snapshot', }, last_message_id: { type: 'string', - title: 'Last Message Id', + title: 'Last Message ID', + description: 'Unique identifier for the last message', }, version: { type: 'integer', title: 'Version', + description: 'Snapshot version', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When snapshot was creted', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When snapshot was updated', }, snapshot: { $ref: '#/components/schemas/SnapshotData', + title: 'Snapshot Data', + description: 'Data for the snapshot', }, links: { items: { @@ -2483,6 +2755,7 @@ export const $SnapshotWithLinks = { }, type: 'array', title: 'Links', + description: 'List of links', }, }, type: 'object', @@ -2497,6 +2770,7 @@ export const $SnapshotWithLinks = { 'links', ], title: 'SnapshotWithLinks', + description: 'Snapshot with links', } as const; export const $StreamCitationGeneration = { @@ -2506,13 +2780,14 @@ export const $StreamCitationGeneration = { $ref: '#/components/schemas/Citation', }, type: 'array', - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat message', default: [], }, }, type: 'object', title: 'StreamCitationGeneration', - description: 'Stream citation generation event.', + description: 'Stream citation generation event', } as const; export const $StreamEnd = { @@ -2526,7 +2801,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Message Id', + title: 'Message ID', + description: 'Unique identifier for the message', }, response_id: { anyOf: [ @@ -2537,7 +2813,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Response Id', + title: 'Response ID', + description: 'Unique identifier for the response', }, generation_id: { anyOf: [ @@ -2548,7 +2825,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, conversation_id: { anyOf: [ @@ -2559,18 +2837,21 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, citations: { items: { $ref: '#/components/schemas/Citation', }, type: 'array', - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat messae.', default: [], }, documents: { @@ -2578,7 +2859,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, search_results: { @@ -2586,7 +2868,8 @@ export const $StreamEnd = { type: 'object', }, type: 'array', - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, search_queries: { @@ -2594,7 +2877,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/SearchQuery', }, type: 'array', - title: 'List of generated search queries.', + title: 'Search Queries', + description: 'List of generated search queries', default: [], }, tool_calls: { @@ -2602,7 +2886,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/ToolCall', }, type: 'array', - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, finish_reason: { @@ -2615,6 +2900,7 @@ export const $StreamEnd = { }, ], title: 'Finish Reason', + description: 'Reson why the model finished the request', }, chat_history: { anyOf: [ @@ -2628,7 +2914,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: + title: 'Chat History', + description: 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', }, error: { @@ -2640,12 +2927,14 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Error message if the response is an error.', + title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', required: ['text'], title: 'StreamEnd', + description: 'Stream end generation event', } as const; export const $StreamEvent = { @@ -2671,13 +2960,14 @@ export const $StreamQueryGeneration = { properties: { query: { type: 'string', - title: 'Search query used to generate grounded response with citations.', + title: 'Query', + description: 'Search query used to generate grounded response with citations', }, }, type: 'object', required: ['query'], title: 'StreamQueryGeneration', - description: 'Stream query generation event.', + description: 'Stream query generation event', } as const; export const $StreamSearchQueriesGeneration = { @@ -2687,13 +2977,14 @@ export const $StreamSearchQueriesGeneration = { $ref: '#/components/schemas/SearchQuery', }, type: 'array', - title: 'Search query used to generate grounded response with citations.', + title: 'Search Queries', + description: 'Search query used to generate grounded response with citations', default: [], }, }, type: 'object', title: 'StreamSearchQueriesGeneration', - description: 'Stream queries generation event.', + description: 'Stream queries generation event', } as const; export const $StreamSearchResults = { @@ -2703,7 +2994,8 @@ export const $StreamSearchResults = { type: 'object', }, type: 'array', - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, documents: { @@ -2711,12 +3003,14 @@ export const $StreamSearchResults = { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, }, type: 'object', title: 'StreamSearchResults', + description: 'Stream search generation event', } as const; export const $StreamStart = { @@ -2730,7 +3024,8 @@ export const $StreamStart = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Generation ID for the event', }, conversation_id: { anyOf: [ @@ -2741,25 +3036,27 @@ export const $StreamStart = { type: 'null', }, ], - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Conversation ID for the event', }, }, type: 'object', title: 'StreamStart', - description: 'Stream start event.', + description: 'Stream start event', } as const; export const $StreamTextGeneration = { properties: { text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', required: ['text'], title: 'StreamTextGeneration', - description: 'Stream text generation event.', + description: 'Stream text generation event', } as const; export const $StreamToolCallsChunk = { @@ -2773,7 +3070,8 @@ export const $StreamToolCallsChunk = { type: 'null', }, ], - title: 'Partial tool call', + title: 'Tool Call Delta', + description: 'Partial tool call', default: {}, }, text: { @@ -2785,12 +3083,13 @@ export const $StreamToolCallsChunk = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', - required: ['text'], title: 'StreamToolCallsChunk', + description: 'Stream tool call chunk generated event', } as const; export const $StreamToolCallsGeneration = { @@ -2804,8 +3103,8 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'List of search results used to generate grounded response with citations', - default: [], + title: 'Stream Search Results', + description: 'Search results used to generate grounded response with citations', }, tool_calls: { anyOf: [ @@ -2819,7 +3118,8 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, text: { @@ -2831,59 +3131,69 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', - required: ['text'], title: 'StreamToolCallsGeneration', - description: 'Stream tool calls generation event.', + description: 'Stream tool calls generation event', } as const; export const $StreamToolInput = { properties: { input_type: { $ref: '#/components/schemas/ToolInputType', + title: 'Input Type', + description: 'Tool input type', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Name of the tool to be used', }, input: { type: 'string', title: 'Input', + description: 'Tool input', }, text: { type: 'string', title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', required: ['input_type', 'tool_name', 'input', 'text'], title: 'StreamToolInput', + description: 'Stream tool input generation event', } as const; export const $StreamToolResult = { properties: { result: { title: 'Result', + description: 'Result from the tool', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Name of tool that generated the result', }, documents: { items: { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, }, type: 'object', required: ['result', 'tool_name'], title: 'StreamToolResult', + description: 'Stream tool result generation event', } as const; export const $ToggleConversationPinRequest = { @@ -2891,11 +3201,13 @@ export const $ToggleConversationPinRequest = { is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, }, type: 'object', required: ['is_pinned'], title: 'ToggleConversationPinRequest', + description: 'Request to toggle pinning a conversation', } as const; export const $Tool = { @@ -2910,6 +3222,7 @@ export const $Tool = { }, ], title: 'Name', + description: 'Name of the Tool', default: '', }, parameter_definitions: { @@ -2922,11 +3235,13 @@ export const $Tool = { }, ], title: 'Parameter Definitions', + description: 'Parameters definitions for the tool', default: {}, }, }, type: 'object', title: 'Tool', + description: 'Tool Schema', } as const; export const $ToolCall = { @@ -2934,16 +3249,19 @@ export const $ToolCall = { name: { type: 'string', title: 'Name', + description: 'Name of the Tool', }, parameters: { type: 'object', title: 'Parameters', + description: 'Parameters for the tool call', default: {}, }, }, type: 'object', required: ['name'], title: 'ToolCall', + description: 'Schema for Tool Call', } as const; export const $ToolCallDelta = { @@ -2958,6 +3276,7 @@ export const $ToolCallDelta = { }, ], title: 'Name', + description: 'Name of the Tool', }, index: { anyOf: [ @@ -2969,6 +3288,7 @@ export const $ToolCallDelta = { }, ], title: 'Index', + description: 'Index', }, parameters: { anyOf: [ @@ -2980,17 +3300,19 @@ export const $ToolCallDelta = { }, ], title: 'Parameters', + description: 'Parameters for the tool call', }, }, type: 'object', - required: ['name', 'index', 'parameters'], title: 'ToolCallDelta', + description: 'Schema for Tool Call Delta', } as const; export const $ToolCategory = { type: 'string', enum: ['Data loader', 'File loader', 'Function', 'Web search'], title: 'ToolCategory', + description: 'Supported Tool Categories', } as const; export const $ToolDefinition = { @@ -3005,6 +3327,7 @@ export const $ToolDefinition = { }, ], title: 'Name', + description: 'Name of the Tool', default: '', }, parameter_definitions: { @@ -3017,16 +3340,19 @@ export const $ToolDefinition = { }, ], title: 'Parameter Definitions', + description: 'Parameters definitions for the tool', default: {}, }, display_name: { type: 'string', title: 'Display Name', + description: 'Display name for the tool', default: '', }, description: { type: 'string', title: 'Description', + description: 'Description of the tool', default: '', }, error_message: { @@ -3039,30 +3365,37 @@ export const $ToolDefinition = { }, ], title: 'Error Message', + description: 'Error message', default: '', }, kwargs: { type: 'object', - title: 'Kwargs', + title: 'kwargs', + description: 'kwags for the tool', default: {}, }, is_visible: { type: 'boolean', title: 'Is Visible', + description: 'Is the tool visible', default: false, }, is_available: { type: 'boolean', title: 'Is Available', + description: 'Is the tool available', default: false, }, category: { $ref: '#/components/schemas/ToolCategory', + title: 'Category', + description: 'Tool category', default: 'Data loader', }, is_auth_required: { type: 'boolean', title: 'Is Auth Required', + description: 'Is auth required for the tool', default: false, }, auth_url: { @@ -3075,6 +3408,7 @@ export const $ToolDefinition = { }, ], title: 'Auth Url', + description: 'Auth url for the tool', default: '', }, token: { @@ -3087,16 +3421,19 @@ export const $ToolDefinition = { }, ], title: 'Token', + description: 'Token for the tool', default: '', }, should_return_token: { type: 'boolean', title: 'Should Return Token', + description: 'If the tool returns a token', default: false, }, }, type: 'object', title: 'ToolDefinition', + description: 'Tool Definition Schema', } as const; export const $ToolInputType = { @@ -3118,6 +3455,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Name', + description: 'Name of the Agent', }, version: { anyOf: [ @@ -3129,6 +3467,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -3140,6 +3479,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -3151,6 +3491,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { anyOf: [ @@ -3162,6 +3503,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -3176,6 +3518,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, organization_id: { anyOf: [ @@ -3186,7 +3529,8 @@ export const $UpdateAgentRequest = { type: 'null', }, ], - title: 'Organization Id', + title: 'Organization ID', + description: 'Organization ID for the Agent', }, is_private: { anyOf: [ @@ -3198,6 +3542,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Is Private', + description: 'If the Agent is private', }, deployment: { anyOf: [ @@ -3209,6 +3554,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Deployment', + description: 'Deployment for the Agent', }, model: { anyOf: [ @@ -3220,6 +3566,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Model', + description: 'Model for the Agent', }, tools_metadata: { anyOf: [ @@ -3234,10 +3581,12 @@ export const $UpdateAgentRequest = { }, ], title: 'Tools Metadata', + description: 'Tools metadata for the Agent', }, }, type: 'object', title: 'UpdateAgentRequest', + description: 'Schema to update an agent', } as const; export const $UpdateAgentToolMetadataRequest = { @@ -3251,7 +3600,8 @@ export const $UpdateAgentToolMetadataRequest = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Agent Tool Metadata ID', }, tool_name: { anyOf: [ @@ -3263,6 +3613,7 @@ export const $UpdateAgentToolMetadataRequest = { }, ], title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { anyOf: [ @@ -3277,10 +3628,12 @@ export const $UpdateAgentToolMetadataRequest = { }, ], title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', title: 'UpdateAgentToolMetadataRequest', + description: 'Request to update Agent Tool Metadata', } as const; export const $UpdateConversationRequest = { @@ -3295,6 +3648,7 @@ export const $UpdateConversationRequest = { }, ], title: 'Title', + description: 'Title of the conversation', }, description: { anyOf: [ @@ -3306,10 +3660,12 @@ export const $UpdateConversationRequest = { }, ], title: 'Description', + description: 'Description of the conversation', }, }, type: 'object', title: 'UpdateConversationRequest', + description: 'Request to update a conversation', } as const; export const $UpdateDeploymentEnv = { @@ -3320,11 +3676,13 @@ export const $UpdateDeploymentEnv = { }, type: 'object', title: 'Env Vars', + description: 'Environment Variables for the Deployment', }, }, type: 'object', required: ['env_vars'], title: 'UpdateDeploymentEnv', + description: 'Request to update Deployment Environment Variables', } as const; export const $UpdateOrganization = { @@ -3339,83 +3697,98 @@ export const $UpdateOrganization = { }, ], title: 'Name', + description: 'Name of the organization', }, }, type: 'object', - required: ['name'], title: 'UpdateOrganization', + description: 'Request to update an organization', } as const; export const $UploadAgentFileResponse = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, }, type: 'object', required: ['id', 'created_at', 'updated_at', 'file_name'], title: 'UploadAgentFileResponse', + description: 'Reponse for uploading an agent file', } as const; export const $UploadConversationFileResponse = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'UploadConversationFileResponse', + description: 'Response for uploading a conversation file', } as const; export const $ValidationError = { @@ -3459,7 +3832,8 @@ export const $backend__schemas__scim__CreateUser = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3471,6 +3845,7 @@ export const $backend__schemas__scim__CreateUser = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3478,9 +3853,12 @@ export const $backend__schemas__scim__CreateUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', }, name: { $ref: '#/components/schemas/Name', + title: 'Name', + description: 'Name of user', }, emails: { items: { @@ -3488,14 +3866,16 @@ export const $backend__schemas__scim__CreateUser = { }, type: 'array', title: 'Emails', + description: 'List of emails for user', }, externalId: { type: 'string', - title: 'Externalid', + title: 'External ID', + description: 'External ID for the user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'name', 'emails', 'externalId'], + required: ['schemas', 'name', 'emails', 'externalId'], title: 'CreateUser', } as const; @@ -3510,7 +3890,8 @@ export const $backend__schemas__scim__UpdateUser = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3522,6 +3903,7 @@ export const $backend__schemas__scim__UpdateUser = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3529,6 +3911,11 @@ export const $backend__schemas__scim__UpdateUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', + }, + name: { + $ref: '#/components/schemas/Name', + description: 'Name of user', }, emails: { items: { @@ -3536,13 +3923,11 @@ export const $backend__schemas__scim__UpdateUser = { }, type: 'array', title: 'Emails', - }, - name: { - $ref: '#/components/schemas/Name', + description: 'List of emails for user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'emails', 'name'], + required: ['schemas', 'name', 'emails'], title: 'UpdateUser', } as const; @@ -3557,7 +3942,8 @@ export const $backend__schemas__scim__User = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3569,6 +3955,7 @@ export const $backend__schemas__scim__User = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3576,21 +3963,25 @@ export const $backend__schemas__scim__User = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the user', }, externalId: { type: 'string', - title: 'Externalid', + title: 'External ID', + description: 'External ID for the user', }, meta: { $ref: '#/components/schemas/Meta', + description: 'Metadata for the user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'id', 'externalId', 'meta'], + required: ['schemas', 'id', 'externalId', 'meta'], title: 'User', } as const; @@ -3606,6 +3997,7 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Password', + description: 'Password for the user', }, hashed_password: { anyOf: [ @@ -3618,10 +4010,12 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Hashed Password', + description: "The user's password hashed", }, fullname: { type: 'string', - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3633,11 +4027,13 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Email', + description: "User's email address", }, }, type: 'object', required: ['fullname'], title: 'CreateUser', + description: 'Request to create a user', } as const; export const $backend__schemas__user__UpdateUser = { @@ -3652,6 +4048,7 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Password', + description: 'Password for the user', }, hashed_password: { anyOf: [ @@ -3664,6 +4061,7 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Hashed Password', + description: "The user's password hashed", }, fullname: { anyOf: [ @@ -3674,7 +4072,8 @@ export const $backend__schemas__user__UpdateUser = { type: 'null', }, ], - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3686,17 +4085,20 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Email', + description: "User's email address", }, }, type: 'object', title: 'UpdateUser', + description: 'Request to update a user', } as const; export const $backend__schemas__user__User = { properties: { fullname: { type: 'string', - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3708,23 +4110,28 @@ export const $backend__schemas__user__User = { }, ], title: 'Email', + description: "User's email address", }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: '', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the user was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the user was updated', }, }, type: 'object', required: ['fullname', 'id', 'created_at', 'updated_at'], title: 'User', + description: 'User schema', } as const; diff --git a/src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts b/src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts index 2bdae5d23f..f4037bd662 100644 --- a/src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts +++ b/src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts @@ -2,7 +2,6 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest'; import type { CancelablePromise } from './core/CancelablePromise'; import type { - ApplyMigrationsMigratePostResponse, AuthorizeV1StrategyAuthPostData, AuthorizeV1StrategyAuthPostResponse, BatchUploadFileV1AgentsBatchUploadFilePostData, @@ -61,8 +60,8 @@ import type { GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse, GetAgentByIdV1AgentsAgentIdGetData, GetAgentByIdV1AgentsAgentIdGetResponse, - GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData, - GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetResponse, + GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData, + GetAgentDeploymentV1AgentsAgentIdDeploymentsGetResponse, GetAgentFileV1AgentsAgentIdFilesFileIdGetData, GetAgentFileV1AgentsAgentIdFilesFileIdGetResponse, GetConversationV1ConversationsConversationIdGetData, @@ -146,17 +145,12 @@ import type { UpdateUserV1UsersUserIdPutResponse, } from './types.gen'; -export class DefaultService { +export class AuthService { constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Strategies * Retrieves the currently enabled list of Authentication strategies. - * - * Args: - * ctx (Context): Context object. - * Returns: - * List[dict]: List of dictionaries containing the enabled auth strategy names. * @returns ListAuthStrategy Successful Response * @throws ApiError */ @@ -172,14 +166,6 @@ export class DefaultService { * Logs user in, performing basic email/password auth. * Verifies their credentials, retrieves the user and returns a JWT token. * - * Args: - * login (Login): Login payload. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * dict: JWT token on Basic auth success - * * Raises: * HTTPException: If the strategy or payload are invalid, or if the login fails. * @param data The data for the request. @@ -203,21 +189,11 @@ export class DefaultService { * Authorize * Callback authorization endpoint used for OAuth providers after authenticating on the provider's login screen. * - * Args: - * strategy (str): Current strategy name. - * request (Request): Current Request object. - * session (Session): DB session. - * code (str): OAuth code. - * ctx (Context): Context object. - * - * Returns: - * dict: Containing "token" key, on success. - * * Raises: * HTTPException: If authentication fails, or strategy is invalid. * @param data The data for the request. - * @param data.strategy - * @param data.code + * @param data.strategy Name of strategy in question + * @param data.code OAuth Code * @returns JWTResponse Successful Response * @throws ApiError */ @@ -242,15 +218,6 @@ export class DefaultService { /** * Logout * Logs out the current user, adding the given JWT token to the blacklist. - * - * Args: - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * token (dict): JWT token payload. - * ctx (Context): Context object. - * - * Returns: - * dict: Empty on success * @returns Logout Successful Response * @throws ApiError */ @@ -269,11 +236,6 @@ export class DefaultService { * * If completed, a ToolAuth is stored in the DB containing the access token for the tool. * - * Args: - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * * Returns: * RedirectResponse: A redirect pointing to the frontend, contains an error query parameter if * an unexpected error happens during the authentication. @@ -296,19 +258,10 @@ export class DefaultService { * * If completed, the corresponding ToolAuth for the requesting user is removed from the DB. * - * Args: - * tool_id (str): Tool ID to be deleted for the user. (eg. google_drive) Should be one of the values listed in the Tool string enum class. - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteToolAuth: Empty response. - * * Raises: * HTTPException: If there was an error deleting the tool auth. * @param data The data for the request. - * @param data.toolId + * @param data.toolId Tool ID for tool in question * @returns DeleteToolAuth Successful Response * @throws ApiError */ @@ -326,19 +279,14 @@ export class DefaultService { }, }); } +} + +export class ChatService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Chat Stream * Stream chat endpoint to handle user messages and return chatbot responses. - * - * Args: - * session (DBSessionDep): Database session. - * chat_request (CohereChatRequest): Chat request data. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * EventSourceResponse: Server-sent event response with chatbot responses. * @param data The data for the request. * @param data.requestBody * @returns ChatResponseEvent Successful Response @@ -361,15 +309,6 @@ export class DefaultService { /** * Regenerate Chat Stream * Endpoint to regenerate stream chat response for the last user message. - * - * Args: - * session (DBSessionDep): Database session. - * chat_request (CohereChatRequest): Chat request data. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * EventSourceResponse: Server-sent event response with chatbot responses. * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -392,15 +331,6 @@ export class DefaultService { /** * Chat * Chat endpoint to handle user messages and return chatbot responses. - * - * Args: - * chat_request (CohereChatRequest): Chat request data. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * NonStreamedChatResponse: Chatbot response. * @param data The data for the request. * @param data.requestBody * @returns NonStreamedChatResponse Successful Response @@ -417,18 +347,14 @@ export class DefaultService { }, }); } +} + +export class UserService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create User * Create a new user. - * - * Args: - * user (CreateUser): User data to be created. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * User: Created user. * @param data The data for the request. * @param data.requestBody * @returns backend__schemas__user__User Successful Response @@ -451,18 +377,9 @@ export class DefaultService { /** * List Users * List all users. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of users to be listed. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[User]: List of users. * @param data The data for the request. - * @param data.offset - * @param data.limit + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -486,18 +403,10 @@ export class DefaultService { * Get User * Get a user by ID. * - * Args: - * user_id (str): User ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * User: User with the given ID. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -520,20 +429,10 @@ export class DefaultService { * Update User * Update a user by ID. * - * Args: - * user_id (str): User ID. - * new_user (UpdateUser): New user data. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object - * - * Returns: - * User: Updated user. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns backend__schemas__user__User Successful Response * @throws ApiError @@ -557,21 +456,12 @@ export class DefaultService { /** * Delete User - * " * Delete a user by ID. * - * Args: - * user_id (str): User ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteUser: Empty response. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns DeleteUser Successful Response * @throws ApiError */ @@ -589,23 +479,19 @@ export class DefaultService { }, }); } +} + +export class ConversationService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Conversation * Get a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * ConversationPublic: Conversation with the given ID. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns ConversationPublic Successful Response * @throws ApiError */ @@ -628,19 +514,10 @@ export class DefaultService { * Update Conversation * Update a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * new_conversation (UpdateConversationRequest): New conversation data. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * ConversationPublic: Updated conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @param data.requestBody * @returns ConversationPublic Successful Response * @throws ApiError @@ -666,18 +543,10 @@ export class DefaultService { * Delete Conversation * Delete a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteConversationResponse: Empty response. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns DeleteConversationResponse Successful Response * @throws ApiError */ @@ -699,22 +568,11 @@ export class DefaultService { /** * List Conversations * List all conversations. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of conversations to be listed. - * order_by (str): A field by which to order the conversations. - * agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * list[ConversationWithoutMessages]: List of conversations. * @param data The data for the request. - * @param data.offset - * @param data.limit - * @param data.orderBy - * @param data.agentId + * @param data.orderBy Field to sorts results by + * @param data.agentId Agent ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns ConversationWithoutMessages Successful Response * @throws ApiError */ @@ -725,10 +583,10 @@ export class DefaultService { method: 'GET', url: '/v1/conversations', query: { - offset: data.offset, - limit: data.limit, order_by: data.orderBy, agent_id: data.agentId, + offset: data.offset, + limit: data.limit, }, errors: { 422: 'Validation Error', @@ -738,8 +596,9 @@ export class DefaultService { /** * Toggle Conversation Pin + * Toggle whether a conversation is pinned or not * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @param data.requestBody * @returns ConversationWithoutMessages Successful Response * @throws ApiError @@ -764,23 +623,12 @@ export class DefaultService { /** * Search Conversations * Search conversations by title. - * - * Args: - * query (str): Query string to search for in conversation titles. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * offset (int): Offset to start the list. - * limit (int): Limit of conversations to be listed. - * agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - * ctx (Context): Context object. - * - * Returns: - * list[ConversationWithoutMessages]: List of conversations that match the query. * @param data The data for the request. - * @param data.query - * @param data.offset - * @param data.limit - * @param data.agentId + * @param data.query Query string to search for in a conversation title + * @param data.orderBy Field to sorts results by + * @param data.agentId Agent ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns ConversationWithoutMessages Successful Response * @throws ApiError */ @@ -792,9 +640,10 @@ export class DefaultService { url: '/v1/conversations:search', query: { query: data.query, + order_by: data.orderBy, + agent_id: data.agentId, offset: data.offset, limit: data.limit, - agent_id: data.agentId, }, errors: { 422: 'Validation Error', @@ -807,15 +656,6 @@ export class DefaultService { * Uploads and creates a batch of File object. * If no conversation_id is provided, a new Conversation is created as well. * - * Args: - * session (DBSessionDep): Database session. - * conversation_id (Optional[str]): Conversation ID passed from request query parameter. - * files (list[FastAPIUploadFile]): List of files to be uploaded. - * ctx (Context): Context object. - * - * Returns: - * list[UploadConversationFileResponse]: List of uploaded files. - * * Raises: * HTTPException: If the conversation with the given ID is not found. Status code 404. * HTTPException: If the file wasn't uploaded correctly. Status code 500. @@ -842,18 +682,10 @@ export class DefaultService { * List Files * List all files from a conversation. Important - no pagination support yet. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[ListConversationFile]: List of files from the conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns ListConversationFile Successful Response * @throws ApiError */ @@ -876,20 +708,11 @@ export class DefaultService { * Get File * Get a conversation file by ID. * - * Args: - * conversation_id (str): Conversation ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * FileMetadata: File with the given ID. - * * Raises: * HTTPException: If the conversation or file with the given ID is not found, or if the file does not belong to the conversation. * @param data The data for the request. - * @param data.conversationId - * @param data.fileId + * @param data.conversationId Conversation ID for conversation in question + * @param data.fileId File ID for file in question * @returns FileMetadata Successful Response * @throws ApiError */ @@ -913,19 +736,11 @@ export class DefaultService { * Delete File * Delete a file by ID. * - * Args: - * conversation_id (str): Conversation ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteFile: Empty response. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId - * @param data.fileId + * @param data.conversationId Conversation ID for conversation in question + * @param data.fileId File ID for file in question * @returns DeleteConversationFileResponse Successful Response * @throws ApiError */ @@ -949,20 +764,11 @@ export class DefaultService { * Generate Title * Generate a title for a conversation and update the conversation with the generated title. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * str: Generated title for the conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId - * @param data.model + * @param data.conversationId Conversation ID for conversation in question + * @param data.model Model to filter results by * @returns GenerateTitleResponse Successful Response * @throws ApiError */ @@ -988,20 +794,11 @@ export class DefaultService { * Synthesize Message * Generate a synthesized audio for a specific message in a conversation. * - * Args: - * conversation_id (str): Conversation ID. - * message_id (str): Message ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Response: Synthesized audio file. - * * Raises: * HTTPException: If the message with the given ID is not found or synthesis fails. * @param data The data for the request. - * @param data.conversationId - * @param data.messageId + * @param data.conversationId Conversation ID for conversation in question + * @param data.messageId Message ID for message in question * @returns unknown Successful Response * @throws ApiError */ @@ -1020,20 +817,16 @@ export class DefaultService { }, }); } +} + +export class ToolService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Tools * List all available tools. - * - * Args: - * request (Request): The request to validate - * session (DBSessionDep): Database session. - * agent_id (str): Agent ID. - * ctx (Context): Context object. - * Returns: - * list[ToolDefinition]: List of available tools. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID to filter results by * @returns ToolDefinition Successful Response * @throws ApiError */ @@ -1051,17 +844,14 @@ export class DefaultService { }, }); } +} + +export class DeploymentService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Deployment * Create a new deployment. - * - * Args: - * deployment (DeploymentCreate): Deployment data to be created. - * session (DBSessionDep): Database session. - * - * Returns: - * DeploymentDefinition: Created deployment. * @param data The data for the request. * @param data.requestBody * @returns DeploymentDefinition Successful Response @@ -1084,15 +874,8 @@ export class DefaultService { /** * List Deployments * List all available deployments and their models. - * - * Args: - * session (DBSessionDep) - * all (bool): Include all deployments, regardless of availability. - * ctx (Context): Context object. - * Returns: - * list[Deployment]: List of available deployment options. * @param data The data for the request. - * @param data.all + * @param data.all Include all deployments, regardless of availability. * @returns DeploymentDefinition Successful Response * @throws ApiError */ @@ -1115,18 +898,10 @@ export class DefaultService { * Update Deployment * Update a deployment. * - * Args: - * deployment_id (str): Deployment ID. - * new_deployment (DeploymentUpdate): Deployment data to be updated. - * session (DBSessionDep): Database session. - * - * Returns: - * Deployment: Updated deployment. - * * Raises: * HTTPException: If deployment not found. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @param data.requestBody * @returns DeploymentDefinition Successful Response * @throws ApiError @@ -1151,11 +926,8 @@ export class DefaultService { /** * Get Deployment * Get a deployment by ID. - * - * Returns: - * Deployment: Deployment with the given ID. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @returns DeploymentDefinition Successful Response * @throws ApiError */ @@ -1178,18 +950,10 @@ export class DefaultService { * Delete Deployment * Delete a deployment by ID. * - * Args: - * deployment_id (str): Deployment ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * DeleteDeployment: Empty response. - * * Raises: * HTTPException: If the deployment with the given ID is not found. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @returns DeleteDeployment Successful Response * @throws ApiError */ @@ -1211,18 +975,10 @@ export class DefaultService { /** * Update Config * Set environment variables for the deployment. - * - * Args: - * deployment_id (str): Deployment ID. - * session (DBSessionDep): Database session. - * env_vars (UpdateDeploymentEnv): Environment variables to set. - * valid_env_vars (str): Validated environment variables. - * Returns: - * str: Empty string. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @param data.requestBody - * @returns unknown Successful Response + * @returns DeploymentDefinition Successful Response * @throws ApiError */ public updateConfigV1DeploymentsDeploymentIdUpdateConfigPost( @@ -1241,15 +997,14 @@ export class DefaultService { }, }); } +} + +export class ExperimentalFeaturesService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Experimental Features * List all experimental features and if they are enabled - * - * Args: - * ctx (Context): Context object. - * Returns: - * Dict[str, bool]: Experimental feature and their isEnabled state * @returns boolean Successful Response * @throws ApiError */ @@ -1259,17 +1014,15 @@ export class DefaultService { url: '/v1/experimental_features/', }); } +} + +export class AgentService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Agent * Create an agent. * - * Args: - * session (DBSessionDep): Database session. - * agent (CreateAgentRequest): Agent data. - * ctx (Context): Context object. - * Returns: - * AgentPublic: Created agent with no user ID or organization ID. * Raises: * HTTPException: If the agent creation fails. * @param data The data for the request. @@ -1294,20 +1047,11 @@ export class DefaultService { /** * List Agents * List all agents. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of agents to be listed. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[AgentPublic]: List of agents with no user ID or organization ID. * @param data The data for the request. - * @param data.offset - * @param data.limit - * @param data.visibility - * @param data.organizationId + * @param data.visibility Agent visibility + * @param data.organizationId Organization ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns AgentPublic Successful Response * @throws ApiError */ @@ -1318,10 +1062,10 @@ export class DefaultService { method: 'GET', url: '/v1/agents', query: { - offset: data.offset, - limit: data.limit, visibility: data.visibility, organization_id: data.organizationId, + offset: data.offset, + limit: data.limit, }, errors: { 422: 'Validation Error', @@ -1331,18 +1075,12 @@ export class DefaultService { /** * Get Agent By Id - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Agent: Agent. + * Return an agent by ID. * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns AgentPublic Successful Response * @throws ApiError */ @@ -1365,19 +1103,10 @@ export class DefaultService { * Update Agent * Update an agent by ID. * - * Args: - * agent_id (str): Agent ID. - * new_agent (UpdateAgentRequest): New agent data. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * AgentPublic: Updated agent with no user ID or organization ID. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @param data.requestBody * @returns AgentPublic Successful Response * @throws ApiError @@ -1403,18 +1132,10 @@ export class DefaultService { * Delete Agent * Delete an agent by ID. * - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteAgent: Empty response. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns DeleteAgent Successful Response * @throws ApiError */ @@ -1434,25 +1155,19 @@ export class DefaultService { } /** - * Get Agent Deployments - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Agent: Agent. + * Get Agent Deployment + * Get the deployment for an agent * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns DeploymentDefinition Successful Response * @throws ApiError */ - public getAgentDeploymentsV1AgentsAgentIdDeploymentsGet( - data: GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData - ): CancelablePromise { + public getAgentDeploymentV1AgentsAgentIdDeploymentsGet( + data: GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData + ): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/v1/agents/{agent_id}/deployments', @@ -1469,18 +1184,10 @@ export class DefaultService { * List Agent Tool Metadata * List all agent tool metadata by agent ID. * - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[AgentToolMetadataPublic]: List of agent tool metadata with no user ID or organization ID. - * * Raises: * HTTPException: If the agent tool metadata retrieval fails. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns AgentToolMetadataPublic Successful Response * @throws ApiError */ @@ -1503,19 +1210,10 @@ export class DefaultService { * Create Agent Tool Metadata * Create an agent tool metadata. * - * Args: - * session (DBSessionDep): Database session. - * agent_id (str): Agent ID. - * agent_tool_metadata (CreateAgentToolMetadataRequest): Agent tool metadata data. - * ctx (Context): Context object. - * - * Returns: - * AgentToolMetadataPublic: Created agent tool metadata. - * * Raises: * HTTPException: If the agent tool metadata creation fails. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @param data.requestBody * @returns AgentToolMetadataPublic Successful Response * @throws ApiError @@ -1541,22 +1239,12 @@ export class DefaultService { * Update Agent Tool Metadata * Update an agent tool metadata by ID. * - * Args: - * agent_id (str): Agent ID. - * agent_tool_metadata_id (str): Agent tool metadata ID. - * session (DBSessionDep): Database session. - * new_agent_tool_metadata (UpdateAgentToolMetadataRequest): New agent tool metadata data. - * ctx (Context): Context object. - * - * Returns: - * AgentToolMetadata: Updated agent tool metadata. - * * Raises: * HTTPException: If the agent tool metadata with the given ID is not found. * HTTPException: If the agent tool metadata update fails. * @param data The data for the request. - * @param data.agentId - * @param data.agentToolMetadataId + * @param data.agentId Agent ID for agent in question + * @param data.agentToolMetadataId Agent Tool Metadata ID for tool metadata in question * @param data.requestBody * @returns AgentToolMetadata Successful Response * @throws ApiError @@ -1583,21 +1271,12 @@ export class DefaultService { * Delete Agent Tool Metadata * Delete an agent tool metadata by ID. * - * Args: - * agent_id (str): Agent ID. - * agent_tool_metadata_id (str): Agent tool metadata ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteAgentToolMetadata: Empty response. - * * Raises: * HTTPException: If the agent tool metadata with the given ID is not found. * HTTPException: If the agent tool metadata deletion fails. * @param data The data for the request. - * @param data.agentId - * @param data.agentToolMetadataId + * @param data.agentId Agent ID for agent in question + * @param data.agentToolMetadataId Agent Tool Metadata ID for tool metadata in question * @returns DeleteAgentToolMetadata Successful Response * @throws ApiError */ @@ -1619,6 +1298,7 @@ export class DefaultService { /** * Batch Upload File + * Upload a batch of files * @param data The data for the request. * @param data.formData * @returns UploadAgentFileResponse Successful Response @@ -1642,20 +1322,11 @@ export class DefaultService { * Get Agent File * Get an agent file by ID. * - * Args: - * agent_id (str): Agent ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * FileMetadata: File with the given ID. - * * Raises: * HTTPException: If the agent or file with the given ID is not found, or if the file does not belong to the agent. * @param data The data for the request. - * @param data.agentId - * @param data.fileId + * @param data.agentId Agent ID for agent in question + * @param data.fileId File ID for file in question * @returns FileMetadata Successful Response * @throws ApiError */ @@ -1679,19 +1350,11 @@ export class DefaultService { * Delete Agent File * Delete an agent file by ID. * - * Args: - * agent_id (str): Agent ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteFile: Empty response. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId - * @param data.fileId + * @param data.agentId Agent ID for agent in question + * @param data.fileId File ID for file in question * @returns DeleteAgentFileResponse Successful Response * @throws ApiError */ @@ -1710,17 +1373,14 @@ export class DefaultService { }, }); } +} + +export class SnapshotService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Snapshots * List all snapshots. - * - * Args: - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[SnapshotWithLinks]: List of all snapshots with their links. * @returns SnapshotWithLinks Successful Response * @throws ApiError */ @@ -1734,14 +1394,6 @@ export class DefaultService { /** * Create Snapshot * Create a new snapshot and snapshot link to share the conversation. - * - * Args: - * snapshot_request (CreateSnapshotRequest): Snapshot creation request. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * CreateSnapshotResponse: Snapshot creation response. * @param data The data for the request. * @param data.requestBody * @returns CreateSnapshotResponse Successful Response @@ -1764,16 +1416,8 @@ export class DefaultService { /** * Get Snapshot * Get a snapshot by link ID. - * - * Args: - * link_id (str): Snapshot link ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Snapshot: Snapshot with the given link ID. * @param data The data for the request. - * @param data.linkId + * @param data.linkId Link ID for the snapshot link in question * @returns SnapshotPublic Successful Response * @throws ApiError */ @@ -1795,16 +1439,8 @@ export class DefaultService { /** * Delete Snapshot Link * Delete a snapshot link by ID. - * - * Args: - * link_id (str): Snapshot link ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteSnapshotLinkResponse: Empty response. * @param data The data for the request. - * @param data.linkId + * @param data.linkId Link ID for the snapshot link in question * @returns DeleteSnapshotLinkResponse Successful Response * @throws ApiError */ @@ -1826,16 +1462,8 @@ export class DefaultService { /** * Delete Snapshot * Delete a snapshot by ID. - * - * Args: - * snapshot_id (str): Snapshot ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteSnapshotResponse: Empty response. * @param data The data for the request. - * @param data.snapshotId + * @param data.snapshotId Snapshot ID for the snapshot in question * @returns DeleteSnapshotResponse Successful Response * @throws ApiError */ @@ -1853,17 +1481,14 @@ export class DefaultService { }, }); } +} + +export class OrganizationService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Organizations * List all available organizations. - * - * Args: - * request (Request): Request object. - * session (DBSessionDep): Database session. - * - * Returns: - * list[Organization]: List of available organizations. * @returns Organization Successful Response * @throws ApiError */ @@ -1877,13 +1502,6 @@ export class DefaultService { /** * Create Organization * Create a new organization. - * - * Args: - * organization (CreateOrganization): Organization data - * session (DBSessionDep): Database session. - * - * Returns: - * Organization: Created organization. * @param data The data for the request. * @param data.requestBody * @returns Organization Successful Response @@ -1906,16 +1524,8 @@ export class DefaultService { /** * Update Organization * Update organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * new_organization (ToolUpdate): New organization data. - * session (DBSessionDep): Database session. - * - * Returns: - * Organization: Updated organization. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @param data.requestBody * @returns Organization Successful Response * @throws ApiError @@ -1940,16 +1550,8 @@ export class DefaultService { /** * Get Organization * Get a organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * session (DBSessionDep): Database session. - * ctx: Context. - * - * Returns: - * Organization: Organization with the given ID. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns Organization Successful Response * @throws ApiError */ @@ -1971,15 +1573,8 @@ export class DefaultService { /** * Delete Organization * Delete a organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteOrganization: Organization deleted. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns DeleteOrganization Successful Response * @throws ApiError */ @@ -2001,15 +1596,8 @@ export class DefaultService { /** * Get Organization Users * Get organization users by ID. - * - * Args: - * organization_id (str): Organization ID. - * session (DBSessionDep): Database session. - * - * Returns: - * list[User]: List of users in the organization * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -2027,17 +1615,14 @@ export class DefaultService { }, }); } +} + +export class ModelService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Model * Create a new model. - * - * Args: - * model (ModelCreate): Model data to be created. - * session (DBSessionDep): Database session. - * - * Returns: - * ModelSchema: Created model. * @param data The data for the request. * @param data.requestBody * @returns Model Successful Response @@ -2060,12 +1645,9 @@ export class DefaultService { /** * List Models * List all available models - * - * Returns: - * list[Model]: List of available models. * @param data The data for the request. - * @param data.offset - * @param data.limit + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns Model Successful Response * @throws ApiError */ @@ -2089,18 +1671,10 @@ export class DefaultService { * Update Model * Update a model by ID. * - * Args: - * model_id (str): Model ID. - * new_model (ModelCreateUpdate): New model data. - * session (DBSessionDep): Database session. - * - * Returns: - * ModelSchema: Updated model. - * * Raises: * HTTPException: If the model with the given ID is not found. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @param data.requestBody * @returns Model Successful Response * @throws ApiError @@ -2125,11 +1699,8 @@ export class DefaultService { /** * Get Model * Get a model by ID. - * - * Returns: - * Model: Model with the given ID. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @returns Model Successful Response * @throws ApiError */ @@ -2152,18 +1723,10 @@ export class DefaultService { * Delete Model * Delete a model by ID. * - * Args: - * model_id (str): Model ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * DeleteModel: Empty response. - * * Raises: * HTTPException: If the model with the given ID is not found. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @returns DeleteModel Successful Response * @throws ApiError */ @@ -2181,13 +1744,18 @@ export class DefaultService { }, }); } +} + +export class ScimService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Users + * Return users * @param data The data for the request. - * @param data.count - * @param data.startIndex - * @param data.filter + * @param data.startIndex Start Index for request + * @param data.count Maximum number of records to return per request + * @param data.filter Filter to use when filtering response * @returns ListUserResponse Successful Response * @throws ApiError */ @@ -2198,8 +1766,8 @@ export class DefaultService { method: 'GET', url: '/scim/v2/Users', query: { - count: data.count, start_index: data.startIndex, + count: data.count, filter: data.filter, }, errors: { @@ -2210,6 +1778,7 @@ export class DefaultService { /** * Create User + * Create a new user * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -2231,8 +1800,9 @@ export class DefaultService { /** * Get User + * Get user by User ID * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns unknown Successful Response * @throws ApiError */ @@ -2253,8 +1823,9 @@ export class DefaultService { /** * Update User + * Update a user * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2278,8 +1849,9 @@ export class DefaultService { /** * Patch User + * Patch a user * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2303,10 +1875,11 @@ export class DefaultService { /** * Get Groups + * Return Groups * @param data The data for the request. - * @param data.count - * @param data.startIndex - * @param data.filter + * @param data.startIndex Start Index for request + * @param data.count Maximum number of records to return per request + * @param data.filter Filter to use when filtering response * @returns ListGroupResponse Successful Response * @throws ApiError */ @@ -2317,8 +1890,8 @@ export class DefaultService { method: 'GET', url: '/scim/v2/Groups', query: { - count: data.count, start_index: data.startIndex, + count: data.count, filter: data.filter, }, errors: { @@ -2329,6 +1902,7 @@ export class DefaultService { /** * Create Group + * Create a group * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -2350,8 +1924,9 @@ export class DefaultService { /** * Get Group + * Get group by group ID * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @returns unknown Successful Response * @throws ApiError */ @@ -2372,8 +1947,9 @@ export class DefaultService { /** * Patch Group + * Patch a group * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2397,8 +1973,9 @@ export class DefaultService { /** * Delete Group + * Delete a group * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @returns void Successful Response * @throws ApiError */ @@ -2416,6 +1993,10 @@ export class DefaultService { }, }); } +} + +export class DefaultService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Health @@ -2429,17 +2010,4 @@ export class DefaultService { url: '/health', }); } - - /** - * Apply Migrations - * Applies Alembic migrations - useful for serverless applications - * @returns unknown Successful Response - * @throws ApiError - */ - public applyMigrationsMigratePost(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/migrate', - }); - } } diff --git a/src/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts b/src/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts index 19570e37bd..988b666e0f 100644 --- a/src/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts +++ b/src/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts @@ -1,45 +1,138 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * Public agent schema + */ export type AgentPublic = { + /** + * User ID for the Agent + */ user_id: string; + /** + * Agent ID + */ id: string; + /** + * When the agent was created + */ created_at: string; + /** + * When the agent was updated + */ updated_at: string; - version: number; + /** + * Name of the Agent + */ name: string; - description: string | null; - preamble: string | null; + /** + * Version of the Agent + */ + version: number; + /** + * Agent Description + */ + description?: string | null; + /** + * The preamble for the Agent + */ + preamble?: string | null; + /** + * The temperature for the Agent + */ temperature: number; - tools: Array | null; + /** + * List of tools for the Agent + */ + tools?: Array | null; + /** + * List of tool metadata for the Agent + */ tools_metadata?: Array | null; - deployment: string | null; - model: string | null; - is_private: boolean | null; + /** + * Deployment for the Agent + */ + deployment?: string | null; + /** + * Model for the Agent + */ + model?: string | null; + /** + * If the Agent is private + */ + is_private?: boolean | null; }; +/** + * Agent tool metadata schema + */ export type AgentToolMetadata = { + /** + * Agent tool metadata ID + */ id: string; + /** + * When the agent tool metadata was created + */ created_at: string; + /** + * When the agent tool metadata was updated + */ updated_at: string; - user_id: string | null; + /** + * User ID for the agent tool metadata + */ + user_id?: string | null; + /** + * Agent ID for the agent tool metadata + */ agent_id: string; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; +/** + * Public agent tool metadata schema + */ export type AgentToolMetadataPublic = { + /** + * Agent tool metadata ID + */ id: string; + /** + * When the agent tool metadata was created + */ created_at: string; + /** + * When the agent tool metadata was updated + */ updated_at: string; + /** + * Agent ID for the agent tool metadata + */ agent_id: string; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; +/** + * Supported values for Agent Visibility + */ export enum AgentVisibility { PRIVATE = 'private', PUBLIC = 'public', @@ -56,22 +149,44 @@ export type Body_batch_upload_file_v1_conversations_batch_upload_file_post = { }; /** - * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message. + * A list of previous messages between the user and the model, meant to give the mode + * conversational context for responding to the user's message. */ export type ChatMessage = { role: ChatRole; + /** + * Contents of the chat message. + */ message?: string | null; + /** + * Contents of the tool plan. + */ tool_plan?: string | null; + /** + * Results from the tool call. + */ tool_results?: Array<{ [key: string]: unknown; }> | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array<{ [key: string]: unknown; }> | null; }; +/** + * Chat Response Event + */ export type ChatResponseEvent = { + /** + * Type of stream event + */ event: StreamEvent; + /** + * Data returned from chat response of a given event type + */ data: | StreamStart | StreamTextGeneration @@ -97,10 +212,25 @@ export enum ChatRole { TOOL = 'TOOL', } +/** + * Schema for a citation + */ export type Citation = { + /** + * Citation text + */ text: string; + /** + * Start position for the citation + */ start: number; + /** + * End position for the citation + */ end: number; + /** + * Documents used for the citation + */ document_ids: Array; }; @@ -117,218 +247,703 @@ export enum CohereChatPromptTruncation { * See: https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L1629 */ export type CohereChatRequest = { + /** + * The message to send to the chatbot + */ message: string; + /** + * A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state. + */ chat_history?: Array | null; + /** + * To store a conversation then create a conversation id and use it for every related request + */ conversation_id?: string; + /** + * + * List of custom or managed tools to use for the response. + * If passing in managed tools, you only need to provide the name of the tool. + * If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. + * Passing a mix of custom and managed tools is not supported. + * + * Managed Tools Examples: + * tools=[ + * { + * "name": "Wiki Retriever - LangChain", + * }, + * { + * "name": "Calculator", + * } + * ] + * + * Custom Tools Examples: + * tools=[ + * { + * "name": "movie_title_generator", + * "description": "tool to generate a cool movie title", + * "parameter_definitions": { + * "synopsis": { + * "description": "short synopsis of the movie", + * "type": "str", + * "required": true + * } + * } + * }, + * { + * "name": "random_number_generator", + * "description": "tool to generate a random number between min and max", + * "parameter_definitions": { + * "min": { + * "description": "minimum number", + * "type": "int", + * "required": true + * }, + * "max": { + * "description": "maximum number", + * "type": "int", + * "required": true + * } + * } + * }, + * { + * "name": "joke_generator", + * "description": "tool to generate a random joke", + * } + * ] + * + */ tools?: Array | null; + /** + * Documents to use to generate grounded response with citations. Example: + * documents=[ + * { + * "id": "national_geographic_everest", + * "title": "Height of Mount Everest", + * "text": "The height of Mount Everest is 29,035 feet", + * "url": "https://education.nationalgeographic.org/resource/mount-everest/", + * }, + * { + * "id": "national_geographic_mariana", + * "title": "Depth of the Mariana Trench", + * "text": "The depth of the Mariana Trench is 36,070 feet", + * "url": "https://www.nationalgeographic.org/activity/mariana-trench-deepest-place-earth", + * }, + * ] + * + */ documents?: Array<{ [key: string]: unknown; }>; + /** + * The model to use for generating the response. + */ model?: string | null; + /** + * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. + */ temperature?: number | null; + /** + * Ensures only the top k most likely tokens are considered for generation at each step. + */ k?: number | null; + /** + * Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k. + */ p?: number | null; + /** + * A string to override the preamble. + */ preamble?: string | null; + /** + * List of File IDs for PDFs used in RAG for the response. + */ file_ids?: Array | null; + /** + * When set to true a list of search queries are generated. No search will occur nor replies to the user's message. + */ search_queries_only?: boolean | null; + /** + * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. + */ max_tokens?: number | null; + /** + * If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed. + */ seed?: number | null; + /** + * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + */ stop_sequences?: Array | null; + /** + * Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. + */ presence_penalty?: number | null; + /** + * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + */ frequency_penalty?: number | null; - prompt_truncation?: CohereChatPromptTruncation; + /** + * Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'. + */ + prompt_truncation?: CohereChatPromptTruncation | null; + /** + * A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations. + */ tool_results?: Array<{ [key: string]: unknown; }> | null; + /** + * If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message. + */ force_single_step?: boolean | null; + /** + * The agent ID to use for the chat. + */ agent_id?: string | null; }; +/** + * Schema for a public conversation file + */ export type ConversationFilePublic = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; +/** + * A public conversation which removes the User ID and Organization ID + */ export type ConversationPublic = { + /** + * Unique identifier for the conversation + */ id: string; + /** + * When the conversation was created + */ created_at: string; + /** + * When the conversation was updated + */ updated_at: string; + /** + * Title of the conversation + */ title: string; + /** + * The conversation messages + */ messages: Array; + /** + * List of files for the conversation + */ files: Array; - description: string | null; - agent_id: string | null; + /** + * Description of the conversation + */ + description?: string | null; + /** + * Unique identifier for the agent used in the conversation + */ + agent_id?: string | null; + /** + * If conversation is pinned + */ is_pinned: boolean; readonly total_file_size: number; }; +/** + * A public conversation without messages attached + */ export type ConversationWithoutMessages = { + /** + * Unique identifier for the conversation + */ id: string; + /** + * When the conversation was created + */ created_at: string; + /** + * When the conversation was updated + */ updated_at: string; + /** + * Title of the conversation + */ title: string; + /** + * List of files for the conversation + */ files: Array; - description: string | null; - agent_id: string | null; + /** + * Description of the conversation + */ + description?: string | null; + /** + * Unique identifier for the agent used in the conversation + */ + agent_id?: string | null; + /** + * If conversation is pinned + */ is_pinned: boolean; readonly total_file_size: number; }; +/** + * Schema to create an agent + */ export type CreateAgentRequest = { + /** + * Name of the Agent + */ name: string; + /** + * Version of the Agent + */ version?: number | null; + /** + * Agent Description + */ description?: string | null; + /** + * The preamble for the Agent + */ preamble?: string | null; + /** + * The temperature for the Agent + */ temperature?: number | null; + /** + * List of tools for the Agent + */ tools?: Array | null; + /** + * Tools metadata for the Agent + */ tools_metadata?: Array | null; + /** + * Deployment for the Agent + */ + deployment: string; + /** + * Deployment config for the Agent + */ deployment_config?: { [key: string]: string; } | null; + /** + * Model for the Agent + */ model: string; - deployment: string; + /** + * Organization ID for the Agent + */ organization_id?: string | null; + /** + * If the Agent is private + */ is_private?: boolean | null; }; +/** + * Request to create Agent Tool Metadata + */ export type CreateAgentToolMetadataRequest = { + /** + * Agent Tool Metadata ID + */ id?: string | null; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; export type CreateGroup = { + /** + * Schemas for the group + */ schemas: Array; + /** + * Members of the group + */ members: Array; + /** + * Display name for the group + */ displayName: string; }; +/** + * Request to create an organization + */ export type CreateOrganization = { + /** + * Name of the organization + */ name: string; }; +/** + * Request to create a snapshot + */ export type CreateSnapshotRequest = { + /** + * Unique identifier for the conversation + */ conversation_id: string; }; +/** + * Response for creating a snapshot + */ export type CreateSnapshotResponse = { + /** + * Unique identifier for the snapshot + */ snapshot_id: string; + /** + * Unique identifier for the link + */ link_id: string; + /** + * List of messages + */ messages: Array; }; +/** + * Response for deleting an agent + */ export type DeleteAgent = unknown; +/** + * Response for deleting an agent file + */ export type DeleteAgentFileResponse = unknown; +/** + * Delete agent tool metadata response + */ export type DeleteAgentToolMetadata = unknown; +/** + * Response for deleting a conversation file + */ export type DeleteConversationFileResponse = unknown; +/** + * Response for deleting a conversation + */ export type DeleteConversationResponse = unknown; +/** + * Delete Deployment Response + */ export type DeleteDeployment = unknown; +/** + * Response for deleting a model + */ export type DeleteModel = unknown; +/** + * Response when deleting organization + */ export type DeleteOrganization = unknown; +/** + * Response for deleting a snapshot link + */ export type DeleteSnapshotLinkResponse = unknown; +/** + * Response for deleting a snapshot + */ export type DeleteSnapshotResponse = unknown; +/** + * Response when deleting a tool auth + */ export type DeleteToolAuth = unknown; +/** + * Response when deleting a user + */ export type DeleteUser = unknown; +/** + * Deployment Create Schema + */ export type DeploymentCreate = { + /** + * Unique Identifier for the Deployment + */ id?: string | null; + /** + * Name of the Deployment + */ name: string; + /** + * Description of the deployment + */ description?: string | null; + /** + * Deployment Class Name + */ deployment_class_name: string; + /** + * Is the deployment from the commmunity + */ is_community?: boolean; + /** + * The default deployment configuration + */ default_deployment_config: { [key: string]: string; }; }; +/** + * Deployment Definition + */ export type DeploymentDefinition = { + /** + * Unique Identifier for the Deployment + */ id: string; + /** + * Name of the Deployment + */ name: string; + /** + * Description of the deployment + */ description?: string | null; + /** + * Config for the deployment + */ config?: { [key: string]: string; }; + /** + * Is deployment is available + */ is_available?: boolean; - is_community?: boolean; + /** + * Is the deployment from the commmunity + */ + is_community?: boolean | null; + /** + * List of models for the deployment + */ models: Array; + /** + * Deployment class name + */ class_name: string; }; +/** + * Deployment Update Schema + */ export type DeploymentUpdate = { + /** + * Name of the Deployment + */ name?: string | null; + /** + * Description of the deployment + */ description?: string | null; + /** + * Deployment Class Name + */ deployment_class_name?: string | null; + /** + * Is the deployment from the commmunity + */ is_community?: boolean | null; + /** + * The default deployment configuration + */ default_deployment_config?: { [key: string]: string; } | null; }; +/** + * Schema for a Document + */ export type Document = { + /** + * Document text + */ text: string; + /** + * Unique Identifier for the document + */ document_id: string; - title: string | null; - url: string | null; - fields: { + /** + * Document title + */ + title?: string | null; + /** + * Document URL + */ + url?: string | null; + /** + * Document Fields + */ + fields?: { [key: string]: unknown; } | null; - tool_name: string | null; + /** + * Tool name for the document + */ + tool_name?: string | null; }; export type Email = { + /** + * Is email the primary email + */ primary: boolean; + /** + * Email value + */ value?: string | null; + /** + * Type of email + */ type: string; }; +/** + * Schema for file metadata + */ export type FileMetadata = { + /** + * Unique identifier of the file + */ id: string; - file_name: string; - file_content: string; - file_size?: number; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; + /** + * Name of the file + */ + file_name: string; + /** + * Size of the file in bytes + */ + file_size?: number; + /** + * The contents of the file + */ + file_content: string; }; +/** + * Response for generating a title + */ export type GenerateTitleResponse = { + /** + * Title generated for the conversation + */ title: string; + /** + * Error message if the response is an error + */ error?: string | null; }; export type Group = { + /** + * Schemas for the group + */ schemas: Array; + /** + * Members of the group + */ members: Array; + /** + * Display name for the group + */ displayName: string; + /** + * Unique identifier for the group + */ id: string; + /** + * Metadata for the group + */ meta: Meta; }; export type GroupMember = { + /** + * Value + */ value: string; + /** + * Display + */ display: string; }; export type GroupOperation = { + /** + * Op + */ op: string; + /** + * Path + */ path?: string | null; + /** + * Value + */ value: | { [key: string]: string; @@ -342,63 +957,186 @@ export type HTTPValidationError = { detail?: Array; }; +/** + * JWT Response + */ export type JWTResponse = { + /** + * JSON Web Token + */ token: string; }; +/** + * List Auth Strategy + */ export type ListAuthStrategy = { + /** + * Auth strategy name + */ strategy: string; - client_id: string | null; - authorization_endpoint: string | null; + /** + * Client ID to be used + */ + client_id?: string | null; + /** + * The endpoint for authorization + */ + authorization_endpoint?: string | null; + /** + * If PKCE is enabled + */ pkce_enabled: boolean; }; +/** + * Listing conversation files + */ export type ListConversationFile = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; export type ListGroupResponse = { + /** + * Total results available + */ totalResults: number; + /** + * Start index for returned results + */ startIndex: number; + /** + * Total results returned in the request + */ itemsPerPage: number; + /** + * List of Groups + */ Resources: Array; }; export type ListUserResponse = { + /** + * Total results available + */ totalResults: number; + /** + * Start index for returned results + */ startIndex: number; + /** + * Total results returned in the request + */ itemsPerPage: number; + /** + * List of Users + */ Resources: Array; }; +/** + * Login Request + */ export type Login = { + /** + * Auth strategy to use + */ strategy: string; + /** + * Login payload depending on strategy used + */ payload?: { [key: string]: string; } | null; }; +/** + * Logout Request + */ export type Logout = unknown; +/** + * Message Schema + */ export type Message = { + /** + * The text content of the message + */ text: string; + /** + * Unique identifier of the message + */ id: string; + /** + * When message was created + */ created_at: string; + /** + * When message was updated + */ updated_at: string; - generation_id: string | null; + /** + * Generation ID for the message + */ + generation_id?: string | null; + /** + * Position in the conversation + */ position: number; + /** + * Is the message active + */ is_active: boolean; + /** + * Documents associated with the message + */ documents: Array; + /** + * Citations associated with the message + */ citations: Array; + /** + * Files associated with the message + */ files: Array; + /** + * Tool calls associated with the message + */ tool_calls: Array; - tool_plan: string | null; + /** + * Tool plan associated with the message + */ + tool_plan?: string | null; + /** + * Agent associated with the message + */ agent: MessageAgent; }; @@ -407,134 +1145,380 @@ export enum MessageAgent { CHATBOT = 'CHATBOT', } +/** + * Schema for metadata + */ export type Meta = { + /** + * Type of resource the metadata is for + */ resourceType: string; + /** + * When metadata was created + */ created: string; + /** + * When metadata was last modified + */ lastModified: string; }; export type Model = { - id: string; + /** + * Model name + */ name: string; + /** + * Cohere model name + */ + cohere_name?: string | null; + /** + * Model description + */ + description?: string | null; + /** + * Unique identifier for the model + */ + id: string; + /** + * Unique identifier for the deployment + */ deployment_id: string; - cohere_name: string | null; - description: string | null; }; export type ModelCreate = { + /** + * Model name + */ name: string; - cohere_name: string | null; - description: string | null; + /** + * Cohere model name + */ + cohere_name?: string | null; + /** + * Model description + */ + description?: string | null; + /** + * Unique identifier for the deployment + */ deployment_id: string; }; export type ModelUpdate = { + /** + * Model name + */ name?: string | null; + /** + * Cohere model name + */ cohere_name?: string | null; + /** + * Model description + */ description?: string | null; + /** + * Unique identifier for the deployment + */ deployment_id?: string | null; }; export type Name = { + /** + * User's given name + */ givenName: string; + /** + * User's family name + */ familyName: string; }; +/** + * Non streamed chat response + */ export type NonStreamedChatResponse = { - response_id: string | null; - generation_id: string | null; - chat_history: Array | null; + /** + * Unique identifier for the response + */ + response_id?: string | null; + /** + * Unique identifier for the generation + */ + generation_id?: string | null; + /** + * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message. + */ + chat_history?: Array | null; + /** + * Reason the chat stream ended + */ finish_reason: string; + /** + * Contents of the chat message + */ text: string; + /** + * Citations for the chat message + */ citations?: Array | null; + /** + * Documents used to generate grounded response with citations + */ documents?: Array | null; + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }> | null; + /** + * List of generated search queries. + */ search_queries?: Array | null; - conversation_id: string | null; + /** + * To store a conversation then create a conversation id and use it for every related request + */ + conversation_id?: string | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array | null; + /** + * Error message if the response is an error + */ error?: string | null; }; export type Operation = { + /** + * Op + */ op: string; + /** + * Value + */ value: { [key: string]: boolean; }; }; +/** + * Schema for an organization + */ export type Organization = { + /** + * Name of the organization + */ name: string; + /** + * Unique identifier of the organization + */ id: string; + /** + * When organization was created + */ created_at: string; + /** + * When organization was updated + */ updated_at: string; }; export type PatchGroup = { + /** + * Schemas for group + */ schemas: Array; + /** + * Operations for the group + */ operations: Array; }; export type PatchUser = { + /** + * Schemas for user + */ schemas: Array; + /** + * Operations for the user + */ operations: Array; }; +/** + * Schema for search query + */ export type SearchQuery = { + /** + * Text for the search + */ text: string; + /** + * Unique identifier for the generation + */ generation_id: string; }; +/** + * Snapshot data + */ export type SnapshotData = { + /** + * Title of the snapshot + */ title: string; + /** + * Description of the snapshot + */ description: string; + /** + * List of messages + */ messages: Array; }; +/** + * Public snapshot + */ export type SnapshotPublic = { + /** + * Unique identifier for the conversation + */ conversation_id: string; + /** + * Unique identifier for the snapshot + */ id: string; + /** + * Unique identifier for the last message + */ last_message_id: string; + /** + * Snapshot version + */ version: number; + /** + * When snapshot was creted + */ created_at: string; + /** + * When snapshot was updated + */ updated_at: string; + /** + * Data for the snapshot + */ snapshot: SnapshotData; }; +/** + * Snapshot with links + */ export type SnapshotWithLinks = { + /** + * Unique identifier for the conversation + */ conversation_id: string; + /** + * Unique identifier for the snapshot + */ id: string; + /** + * Unique identifier for the last message + */ last_message_id: string; + /** + * Snapshot version + */ version: number; + /** + * When snapshot was creted + */ created_at: string; + /** + * When snapshot was updated + */ updated_at: string; + /** + * Data for the snapshot + */ snapshot: SnapshotData; + /** + * List of links + */ links: Array; }; /** - * Stream citation generation event. + * Stream citation generation event */ export type StreamCitationGeneration = { + /** + * Citations for the chat message + */ citations?: Array; }; +/** + * Stream end generation event + */ export type StreamEnd = { + /** + * Unique identifier for the message + */ message_id?: string | null; + /** + * Unique identifier for the response + */ response_id?: string | null; + /** + * Unique identifier for the generation + */ generation_id?: string | null; + /** + * Unique identifier for the conversation + */ conversation_id?: string | null; + /** + * Contents of the chat message + */ text: string; + /** + * Citations for the chat messae. + */ citations?: Array; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }>; + /** + * List of generated search queries + */ search_queries?: Array; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array; + /** + * Reson why the model finished the request + */ finish_reason?: string | null; + /** + * A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state. + */ chat_history?: Array | null; + /** + * Error message if the response is an error + */ error?: string | null; }; @@ -556,92 +1540,200 @@ export enum StreamEvent { } /** - * Stream query generation event. + * Stream query generation event */ export type StreamQueryGeneration = { + /** + * Search query used to generate grounded response with citations + */ query: string; }; /** - * Stream queries generation event. + * Stream queries generation event */ export type StreamSearchQueriesGeneration = { + /** + * Search query used to generate grounded response with citations + */ search_queries?: Array; }; +/** + * Stream search generation event + */ export type StreamSearchResults = { + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }>; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; }; /** - * Stream start event. + * Stream start event */ export type StreamStart = { + /** + * Generation ID for the event + */ generation_id?: string | null; + /** + * Conversation ID for the event + */ conversation_id?: string | null; }; /** - * Stream text generation event. + * Stream text generation event */ export type StreamTextGeneration = { + /** + * Contents of the chat message + */ text: string; }; +/** + * Stream tool call chunk generated event + */ export type StreamToolCallsChunk = { + /** + * Partial tool call + */ tool_call_delta?: ToolCallDelta | null; - text: string | null; + /** + * Contents of the chat message + */ + text?: string | null; }; /** - * Stream tool calls generation event. + * Stream tool calls generation event */ export type StreamToolCallsGeneration = { + /** + * Search results used to generate grounded response with citations + */ stream_search_results?: StreamSearchResults | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array | null; - text: string | null; + /** + * Contents of the chat message + */ + text?: string | null; }; +/** + * Stream tool input generation event + */ export type StreamToolInput = { + /** + * Tool input type + */ input_type: ToolInputType; + /** + * Name of the tool to be used + */ tool_name: string; + /** + * Tool input + */ input: string; + /** + * Contents of the chat message + */ text: string; }; +/** + * Stream tool result generation event + */ export type StreamToolResult = { + /** + * Result from the tool + */ result: unknown; + /** + * Name of tool that generated the result + */ tool_name: string; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; }; +/** + * Request to toggle pinning a conversation + */ export type ToggleConversationPinRequest = { + /** + * If conversation is pinned + */ is_pinned: boolean; }; +/** + * Tool Schema + */ export type Tool = { + /** + * Name of the Tool + */ name?: string | null; + /** + * Parameters definitions for the tool + */ parameter_definitions?: { [key: string]: unknown; } | null; }; +/** + * Schema for Tool Call + */ export type ToolCall = { + /** + * Name of the Tool + */ name: string; + /** + * Parameters for the tool call + */ parameters?: { [key: string]: unknown; }; }; +/** + * Schema for Tool Call Delta + */ export type ToolCallDelta = { - name: string | null; - index: number | null; - parameters: string | null; + /** + * Name of the Tool + */ + name?: string | null; + /** + * Index + */ + index?: number | null; + /** + * Parameters for the tool call + */ + parameters?: string | null; }; +/** + * Supported Tool Categories + */ export enum ToolCategory { DATA_LOADER = 'Data loader', FILE_LOADER = 'File loader', @@ -649,23 +1741,65 @@ export enum ToolCategory { WEB_SEARCH = 'Web search', } +/** + * Tool Definition Schema + */ export type ToolDefinition = { + /** + * Name of the Tool + */ name?: string | null; + /** + * Parameters definitions for the tool + */ parameter_definitions?: { [key: string]: unknown; } | null; + /** + * Display name for the tool + */ display_name?: string; + /** + * Description of the tool + */ description?: string; + /** + * Error message + */ error_message?: string | null; + /** + * kwags for the tool + */ kwargs?: { [key: string]: unknown; }; + /** + * Is the tool visible + */ is_visible?: boolean; + /** + * Is the tool available + */ is_available?: boolean; + /** + * Tool category + */ category?: ToolCategory; + /** + * Is auth required for the tool + */ is_auth_required?: boolean; + /** + * Auth url for the tool + */ auth_url?: string | null; + /** + * Token for the tool + */ token?: string | null; + /** + * If the tool returns a token + */ should_return_token?: boolean; }; @@ -677,59 +1811,170 @@ export enum ToolInputType { CODE = 'CODE', } +/** + * Schema to update an agent + */ export type UpdateAgentRequest = { + /** + * Name of the Agent + */ name?: string | null; + /** + * Version of the Agent + */ version?: number | null; + /** + * Agent Description + */ description?: string | null; + /** + * The preamble for the Agent + */ preamble?: string | null; + /** + * The temperature for the Agent + */ temperature?: number | null; + /** + * List of tools for the Agent + */ tools?: Array | null; + /** + * Organization ID for the Agent + */ organization_id?: string | null; + /** + * If the Agent is private + */ is_private?: boolean | null; + /** + * Deployment for the Agent + */ deployment?: string | null; + /** + * Model for the Agent + */ model?: string | null; + /** + * Tools metadata for the Agent + */ tools_metadata?: Array | null; }; +/** + * Request to update Agent Tool Metadata + */ export type UpdateAgentToolMetadataRequest = { + /** + * Agent Tool Metadata ID + */ id?: string | null; + /** + * Tool Name for the agent tool metadata + */ tool_name?: string | null; + /** + * Artifacts for the agent tool metadata + */ artifacts?: Array<{ [key: string]: unknown; }> | null; }; +/** + * Request to update a conversation + */ export type UpdateConversationRequest = { + /** + * Title of the conversation + */ title?: string | null; + /** + * Description of the conversation + */ description?: string | null; }; +/** + * Request to update Deployment Environment Variables + */ export type UpdateDeploymentEnv = { + /** + * Environment Variables for the Deployment + */ env_vars: { [key: string]: string; }; }; +/** + * Request to update an organization + */ export type UpdateOrganization = { - name: string | null; + /** + * Name of the organization + */ + name?: string | null; }; +/** + * Reponse for uploading an agent file + */ export type UploadAgentFileResponse = { + /** + * Unique identifier of the file + */ id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; }; +/** + * Response for uploading a conversation file + */ export type UploadConversationFileResponse = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; export type ValidationError = { @@ -739,50 +1984,146 @@ export type ValidationError = { }; export type backend__schemas__scim__CreateUser = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; + /** + * Name of user + */ name: Name; + /** + * List of emails for user + */ emails: Array; + /** + * External ID for the user + */ externalId: string; }; export type backend__schemas__scim__UpdateUser = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; - emails: Array; + /** + * Name of user + */ name: Name; + /** + * List of emails for user + */ + emails: Array; }; export type backend__schemas__scim__User = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; + /** + * Unique identifier for the user + */ id: string; + /** + * External ID for the user + */ externalId: string; + /** + * Metadata for the user + */ meta: Meta; }; +/** + * Request to create a user + */ export type backend__schemas__user__CreateUser = { + /** + * Password for the user + */ password?: string | null; + /** + * The user's password hashed + */ hashed_password?: (Blob | File) | null; + /** + * User's Full Name + */ fullname: string; + /** + * User's email address + */ email?: string | null; }; +/** + * Request to update a user + */ export type backend__schemas__user__UpdateUser = { + /** + * Password for the user + */ password?: string | null; + /** + * The user's password hashed + */ hashed_password?: (Blob | File) | null; + /** + * User's Full Name + */ fullname?: string | null; + /** + * User's email address + */ email?: string | null; }; +/** + * User schema + */ export type backend__schemas__user__User = { + /** + * User's Full Name + */ fullname: string; + /** + * User's email address + */ email?: string | null; id: string; + /** + * When the user was created + */ created_at: string; + /** + * When the user was updated + */ updated_at: string; }; @@ -795,7 +2136,13 @@ export type LoginV1LoginPostData = { export type LoginV1LoginPostResponse = JWTResponse | null; export type AuthorizeV1StrategyAuthPostData = { - code?: string; + /** + * OAuth Code + */ + code?: string | null; + /** + * Name of strategy in question + */ strategy: string; }; @@ -806,6 +2153,9 @@ export type LogoutV1LogoutGetResponse = Logout; export type ToolAuthV1ToolAuthGetResponse = unknown; export type DeleteToolAuthV1ToolAuthToolIdDeleteData = { + /** + * Tool ID for tool in question + */ toolId: string; }; @@ -836,13 +2186,22 @@ export type CreateUserV1UsersPostData = { export type CreateUserV1UsersPostResponse = backend__schemas__user__User; export type ListUsersV1UsersGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; }; export type ListUsersV1UsersGetResponse = Array; export type GetUserV1UsersUserIdGetData = { + /** + * User ID for the user in question + */ userId: string; }; @@ -850,24 +2209,36 @@ export type GetUserV1UsersUserIdGetResponse = backend__schemas__user__User; export type UpdateUserV1UsersUserIdPutData = { requestBody: backend__schemas__user__UpdateUser; + /** + * User ID for the user in question + */ userId: string; }; export type UpdateUserV1UsersUserIdPutResponse = backend__schemas__user__User; export type DeleteUserV1UsersUserIdDeleteData = { + /** + * User ID for the user in question + */ userId: string; }; export type DeleteUserV1UsersUserIdDeleteResponse = DeleteUser; export type GetConversationV1ConversationsConversationIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; export type GetConversationV1ConversationsConversationIdGetResponse = ConversationPublic; export type UpdateConversationV1ConversationsConversationIdPutData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; requestBody: UpdateConversationRequest; }; @@ -875,6 +2246,9 @@ export type UpdateConversationV1ConversationsConversationIdPutData = { export type UpdateConversationV1ConversationsConversationIdPutResponse = ConversationPublic; export type DeleteConversationV1ConversationsConversationIdDeleteData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; @@ -882,15 +2256,30 @@ export type DeleteConversationV1ConversationsConversationIdDeleteResponse = DeleteConversationResponse; export type ListConversationsV1ConversationsGetData = { - agentId?: string; + /** + * Agent ID to filter results by + */ + agentId?: string | null; + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; - orderBy?: string; + /** + * Field to sorts results by + */ + orderBy?: string | null; }; export type ListConversationsV1ConversationsGetResponse = Array; export type ToggleConversationPinV1ConversationsConversationIdTogglePinPutData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; requestBody: ToggleConversationPinRequest; }; @@ -899,9 +2288,25 @@ export type ToggleConversationPinV1ConversationsConversationIdTogglePinPutRespon ConversationWithoutMessages; export type SearchConversationsV1ConversationsSearchGetData = { - agentId?: string; + /** + * Agent ID to filter results by + */ + agentId?: string | null; + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; + /** + * Field to sorts results by + */ + orderBy?: string | null; + /** + * Query string to search for in a conversation title + */ query: string; }; @@ -916,20 +2321,35 @@ export type BatchUploadFileV1ConversationsBatchUploadFilePostResponse = Array; export type ListFilesV1ConversationsConversationIdFilesGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; export type ListFilesV1ConversationsConversationIdFilesGetResponse = Array; export type GetFileV1ConversationsConversationIdFilesFileIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * File ID for file in question + */ fileId: string; }; export type GetFileV1ConversationsConversationIdFilesFileIdGetResponse = FileMetadata; export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * File ID for file in question + */ fileId: string; }; @@ -937,7 +2357,13 @@ export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteResponse = DeleteConversationFileResponse; export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * Model to filter results by + */ model?: string | null; }; @@ -945,13 +2371,22 @@ export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse GenerateTitleResponse; export type SynthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * Message ID for message in question + */ messageId: string; }; export type SynthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGetResponse = unknown; export type ListToolsV1ToolsGetData = { + /** + * Agent ID to filter results by + */ agentId?: string | null; }; @@ -964,12 +2399,18 @@ export type CreateDeploymentV1DeploymentsPostData = { export type CreateDeploymentV1DeploymentsPostResponse = DeploymentDefinition; export type ListDeploymentsV1DeploymentsGetData = { - all?: boolean; + /** + * Include all deployments, regardless of availability. + */ + all?: boolean | null; }; export type ListDeploymentsV1DeploymentsGetResponse = Array; export type UpdateDeploymentV1DeploymentsDeploymentIdPutData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; requestBody: DeploymentUpdate; }; @@ -977,23 +2418,32 @@ export type UpdateDeploymentV1DeploymentsDeploymentIdPutData = { export type UpdateDeploymentV1DeploymentsDeploymentIdPutResponse = DeploymentDefinition; export type GetDeploymentV1DeploymentsDeploymentIdGetData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; }; export type GetDeploymentV1DeploymentsDeploymentIdGetResponse = DeploymentDefinition; export type DeleteDeploymentV1DeploymentsDeploymentIdDeleteData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; }; export type DeleteDeploymentV1DeploymentsDeploymentIdDeleteResponse = DeleteDeployment; export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; requestBody: UpdateDeploymentEnv; }; -export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostResponse = unknown; +export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostResponse = DeploymentDefinition; export type ListExperimentalFeaturesV1ExperimentalFeaturesGetResponse = { [key: string]: boolean; @@ -1006,21 +2456,39 @@ export type CreateAgentV1AgentsPostData = { export type CreateAgentV1AgentsPostResponse = AgentPublic; export type ListAgentsV1AgentsGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; + /** + * Organization ID to filter results by + */ organizationId?: string | null; + /** + * Agent visibility + */ visibility?: AgentVisibility; }; export type ListAgentsV1AgentsGetResponse = Array; export type GetAgentByIdV1AgentsAgentIdGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; export type GetAgentByIdV1AgentsAgentIdGetResponse = AgentPublic; export type UpdateAgentV1AgentsAgentIdPutData = { + /** + * Agent ID for agent in question + */ agentId: string; requestBody: UpdateAgentRequest; }; @@ -1028,18 +2496,27 @@ export type UpdateAgentV1AgentsAgentIdPutData = { export type UpdateAgentV1AgentsAgentIdPutResponse = AgentPublic; export type DeleteAgentV1AgentsAgentIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; }; export type DeleteAgentV1AgentsAgentIdDeleteResponse = DeleteAgent; -export type GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData = { +export type GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; -export type GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetResponse = Array; +export type GetAgentDeploymentV1AgentsAgentIdDeploymentsGetResponse = Array; export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; @@ -1047,6 +2524,9 @@ export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetResponse = Array; export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostData = { + /** + * Agent ID for agent in question + */ agentId: string; requestBody: CreateAgentToolMetadataRequest; }; @@ -1055,7 +2535,13 @@ export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostResponse = AgentToolMetadataPublic; export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * Agent Tool Metadata ID for tool metadata in question + */ agentToolMetadataId: string; requestBody: UpdateAgentToolMetadataRequest; }; @@ -1064,7 +2550,13 @@ export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataI AgentToolMetadata; export type DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * Agent Tool Metadata ID for tool metadata in question + */ agentToolMetadataId: string; }; @@ -1078,14 +2570,26 @@ export type BatchUploadFileV1AgentsBatchUploadFilePostData = { export type BatchUploadFileV1AgentsBatchUploadFilePostResponse = Array; export type GetAgentFileV1AgentsAgentIdFilesFileIdGetData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * File ID for file in question + */ fileId: string; }; export type GetAgentFileV1AgentsAgentIdFilesFileIdGetResponse = FileMetadata; export type DeleteAgentFileV1AgentsAgentIdFilesFileIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * File ID for file in question + */ fileId: string; }; @@ -1100,18 +2604,27 @@ export type CreateSnapshotV1SnapshotsPostData = { export type CreateSnapshotV1SnapshotsPostResponse = CreateSnapshotResponse; export type GetSnapshotV1SnapshotsLinkLinkIdGetData = { + /** + * Link ID for the snapshot link in question + */ linkId: string; }; export type GetSnapshotV1SnapshotsLinkLinkIdGetResponse = SnapshotPublic; export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteData = { + /** + * Link ID for the snapshot link in question + */ linkId: string; }; export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteResponse = DeleteSnapshotLinkResponse; export type DeleteSnapshotV1SnapshotsSnapshotIdDeleteData = { + /** + * Snapshot ID for the snapshot in question + */ snapshotId: string; }; @@ -1126,6 +2639,9 @@ export type CreateOrganizationV1OrganizationsPostData = { export type CreateOrganizationV1OrganizationsPostResponse = Organization; export type UpdateOrganizationV1OrganizationsOrganizationIdPutData = { + /** + * Organization ID for the organization in question + */ organizationId: string; requestBody: UpdateOrganization; }; @@ -1133,18 +2649,27 @@ export type UpdateOrganizationV1OrganizationsOrganizationIdPutData = { export type UpdateOrganizationV1OrganizationsOrganizationIdPutResponse = Organization; export type GetOrganizationV1OrganizationsOrganizationIdGetData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; export type GetOrganizationV1OrganizationsOrganizationIdGetResponse = Organization; export type DeleteOrganizationV1OrganizationsOrganizationIdDeleteData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; export type DeleteOrganizationV1OrganizationsOrganizationIdDeleteResponse = DeleteOrganization; export type GetOrganizationUsersV1OrganizationsOrganizationIdUsersGetData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; @@ -1158,13 +2683,22 @@ export type CreateModelV1ModelsPostData = { export type CreateModelV1ModelsPostResponse = Model; export type ListModelsV1ModelsGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; }; export type ListModelsV1ModelsGetResponse = Array; export type UpdateModelV1ModelsModelIdPutData = { + /** + * Model ID for the model in question + */ modelId: string; requestBody: ModelUpdate; }; @@ -1172,20 +2706,35 @@ export type UpdateModelV1ModelsModelIdPutData = { export type UpdateModelV1ModelsModelIdPutResponse = Model; export type GetModelV1ModelsModelIdGetData = { + /** + * Model ID for the model in question + */ modelId: string; }; export type GetModelV1ModelsModelIdGetResponse = Model; export type DeleteModelV1ModelsModelIdDeleteData = { + /** + * Model ID for the model in question + */ modelId: string; }; export type DeleteModelV1ModelsModelIdDeleteResponse = DeleteModel; export type GetUsersScimV2UsersGetData = { + /** + * Maximum number of records to return per request + */ count?: number; + /** + * Filter to use when filtering response + */ filter?: string | null; + /** + * Start Index for request + */ startIndex?: number; }; @@ -1198,6 +2747,9 @@ export type CreateUserScimV2UsersPostData = { export type CreateUserScimV2UsersPostResponse = unknown; export type GetUserScimV2UsersUserIdGetData = { + /** + * User ID for the user in question + */ userId: string; }; @@ -1205,6 +2757,9 @@ export type GetUserScimV2UsersUserIdGetResponse = unknown; export type UpdateUserScimV2UsersUserIdPutData = { requestBody: backend__schemas__scim__UpdateUser; + /** + * User ID for the user in question + */ userId: string; }; @@ -1212,14 +2767,26 @@ export type UpdateUserScimV2UsersUserIdPutResponse = unknown; export type PatchUserScimV2UsersUserIdPatchData = { requestBody: PatchUser; + /** + * User ID for the user in question + */ userId: string; }; export type PatchUserScimV2UsersUserIdPatchResponse = unknown; export type GetGroupsScimV2GroupsGetData = { + /** + * Maximum number of records to return per request + */ count?: number; + /** + * Filter to use when filtering response + */ filter?: string | null; + /** + * Start Index for request + */ startIndex?: number; }; @@ -1232,12 +2799,18 @@ export type CreateGroupScimV2GroupsPostData = { export type CreateGroupScimV2GroupsPostResponse = unknown; export type GetGroupScimV2GroupsGroupIdGetData = { + /** + * Group ID for the group in question + */ groupId: string; }; export type GetGroupScimV2GroupsGroupIdGetResponse = unknown; export type PatchGroupScimV2GroupsGroupIdPatchData = { + /** + * Group ID for the group in question + */ groupId: string; requestBody: PatchGroup; }; @@ -1245,6 +2818,9 @@ export type PatchGroupScimV2GroupsGroupIdPatchData = { export type PatchGroupScimV2GroupsGroupIdPatchResponse = unknown; export type DeleteGroupScimV2GroupsGroupIdDeleteData = { + /** + * Group ID for the group in question + */ groupId: string; }; @@ -1252,8 +2828,6 @@ export type DeleteGroupScimV2GroupsGroupIdDeleteResponse = void; export type HealthHealthGetResponse = unknown; -export type ApplyMigrationsMigratePostResponse = unknown; - export type $OpenApiTs = { '/v1/auth_strategies': { get: { @@ -1709,7 +3283,7 @@ export type $OpenApiTs = { /** * Successful Response */ - 200: unknown; + 200: DeploymentDefinition; /** * Validation Error */ @@ -1800,7 +3374,7 @@ export type $OpenApiTs = { }; '/v1/agents/{agent_id}/deployments': { get: { - req: GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData; + req: GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData; res: { /** * Successful Response @@ -2274,14 +3848,4 @@ export type $OpenApiTs = { }; }; }; - '/migrate': { - post: { - res: { - /** - * Successful Response - */ - 200: unknown; - }; - }; - }; }; diff --git a/src/interfaces/assistants_web/src/components/SideNavPanel/ConversationCard.tsx b/src/interfaces/assistants_web/src/components/SideNavPanel/ConversationCard.tsx index 5ed810682a..74fcefc7d7 100644 --- a/src/interfaces/assistants_web/src/components/SideNavPanel/ConversationCard.tsx +++ b/src/interfaces/assistants_web/src/components/SideNavPanel/ConversationCard.tsx @@ -21,7 +21,7 @@ export type ConversationListItem = { conversationId: string; updatedAt: string; title: string; - description: string | null; + description: string | null | undefined; isPinned: boolean; weekHeading?: string; agent?: AgentPublic; diff --git a/src/interfaces/coral_web/src/cohere-client/client.ts b/src/interfaces/coral_web/src/cohere-client/client.ts index 9ac8b32046..12c8416130 100644 --- a/src/interfaces/coral_web/src/cohere-client/client.ts +++ b/src/interfaces/coral_web/src/cohere-client/client.ts @@ -51,20 +51,22 @@ export class CohereClient { } public batchUploadFile(formData: Body_batch_upload_file_v1_conversations_batch_upload_file_post) { - return this.cohereService.default.batchUploadFileV1ConversationsBatchUploadFilePost({ + return this.cohereService.conversation.batchUploadFileV1ConversationsBatchUploadFilePost({ formData, }); } public deletefile({ conversationId, fileId }: { conversationId: string; fileId: string }) { - return this.cohereService.default.deleteFileV1ConversationsConversationIdFilesFileIdDelete({ - conversationId, - fileId, - }); + return this.cohereService.conversation.deleteFileV1ConversationsConversationIdFilesFileIdDelete( + { + conversationId, + fileId, + } + ); } public listFiles({ conversationId }: { conversationId: string }) { - return this.cohereService.default.listFilesV1ConversationsConversationIdFilesGet({ + return this.cohereService.conversation.listFilesV1ConversationsConversationIdFilesGet({ conversationId, }); } @@ -125,56 +127,56 @@ export class CohereClient { } public listConversations(params: { offset?: number; limit?: number; agentId?: string }) { - return this.cohereService.default.listConversationsV1ConversationsGet(params); + return this.cohereService.conversation.listConversationsV1ConversationsGet(params); } public getConversation({ conversationId }: { conversationId: string }) { - return this.cohereService.default.getConversationV1ConversationsConversationIdGet({ + return this.cohereService.conversation.getConversationV1ConversationsConversationIdGet({ conversationId, }); } public deleteConversation({ conversationId }: { conversationId: string }) { - return this.cohereService.default.deleteConversationV1ConversationsConversationIdDelete({ + return this.cohereService.conversation.deleteConversationV1ConversationsConversationIdDelete({ conversationId, }); } public editConversation(requestBody: UpdateConversationRequest, conversationId: string) { - return this.cohereService.default.updateConversationV1ConversationsConversationIdPut({ + return this.cohereService.conversation.updateConversationV1ConversationsConversationIdPut({ conversationId: conversationId, requestBody, }); } public listTools({ agentId }: { agentId?: string | null }) { - return this.cohereService.default.listToolsV1ToolsGet({ agentId }); + return this.cohereService.tool.listToolsV1ToolsGet({ agentId }); } public listDeployments({ all }: { all?: boolean }) { - return this.cohereService.default.listDeploymentsV1DeploymentsGet({ all }); + return this.cohereService.deployment.listDeploymentsV1DeploymentsGet({ all }); } public updateDeploymentEnvVariables(requestBody: UpdateDeploymentEnv, deploymentId: string) { - return this.cohereService.default.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ + return this.cohereService.deployment.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ deploymentId: deploymentId, requestBody, }); } public updateDeploymentConfig(deploymentId: string, requestBody: UpdateDeploymentEnv) { - return this.cohereService.default.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ + return this.cohereService.deployment.updateConfigV1DeploymentsDeploymentIdUpdateConfigPost({ deploymentId: deploymentId, requestBody, }); } public getExperimentalFeatures() { - return this.cohereService.default.listExperimentalFeaturesV1ExperimentalFeaturesGet(); + return this.cohereService.experimentalFeatures.listExperimentalFeaturesV1ExperimentalFeaturesGet(); } public login({ email, password }: { email: string; password: string }) { - return this.cohereService.default.loginV1LoginPost({ + return this.cohereService.auth.loginV1LoginPost({ requestBody: { strategy: 'Basic', payload: { email, password }, @@ -183,15 +185,15 @@ export class CohereClient { } public logout() { - return this.cohereService.default.logoutV1LogoutGet(); + return this.cohereService.auth.logoutV1LogoutGet(); } public getAuthStrategies() { - return this.cohereService.default.getStrategiesV1AuthStrategiesGet(); + return this.cohereService.auth.getStrategiesV1AuthStrategiesGet(); } public createUser(requestBody: CreateUserV1UsersPostData) { - return this.cohereService.default.createUserV1UsersPost(requestBody); + return this.cohereService.user.createUserV1UsersPost(requestBody); } public async googleSSOAuth({ code }: { code: string }) { @@ -250,52 +252,54 @@ export class CohereClient { } public getAgent(agentId: string) { - return this.cohereService.default.getAgentByIdV1AgentsAgentIdGet({ agentId }); + return this.cohereService.agent.getAgentByIdV1AgentsAgentIdGet({ agentId }); } public createAgent(requestBody: CreateAgentRequest) { - return this.cohereService.default.createAgentV1AgentsPost({ requestBody }); + return this.cohereService.agent.createAgentV1AgentsPost({ requestBody }); } public listAgents({ offset, limit = 100 }: { offset?: number; limit?: number }) { - return this.cohereService.default.listAgentsV1AgentsGet({ offset, limit }); + return this.cohereService.agent.listAgentsV1AgentsGet({ offset, limit }); } public updateAgent(requestBody: UpdateAgentRequest, agentId: string) { - return this.cohereService.default.updateAgentV1AgentsAgentIdPut({ + return this.cohereService.agent.updateAgentV1AgentsAgentIdPut({ agentId: agentId, requestBody, }); } public deleteAgent(request: { agentId: string }) { - return this.cohereService.default.deleteAgentV1AgentsAgentIdDelete(request); + return this.cohereService.agent.deleteAgentV1AgentsAgentIdDelete(request); } public generateTitle({ conversationId }: { conversationId: string }) { - return this.cohereService.default.generateTitleV1ConversationsConversationIdGenerateTitlePost({ - conversationId, - }); + return this.cohereService.conversation.generateTitleV1ConversationsConversationIdGenerateTitlePost( + { + conversationId, + } + ); } public listSnapshots() { - return this.cohereService.default.listSnapshotsV1SnapshotsGet(); + return this.cohereService.snapshot.listSnapshotsV1SnapshotsGet(); } public createSnapshot(requestBody: CreateSnapshotRequest) { - return this.cohereService.default.createSnapshotV1SnapshotsPost({ requestBody }); + return this.cohereService.snapshot.createSnapshotV1SnapshotsPost({ requestBody }); } public getSnapshot({ linkId }: { linkId: string }) { - return this.cohereService.default.getSnapshotV1SnapshotsLinkLinkIdGet({ linkId }); + return this.cohereService.snapshot.getSnapshotV1SnapshotsLinkLinkIdGet({ linkId }); } public deleteSnapshotLink({ linkId }: { linkId: string }) { - return this.cohereService.default.deleteSnapshotLinkV1SnapshotsLinkLinkIdDelete({ linkId }); + return this.cohereService.snapshot.deleteSnapshotLinkV1SnapshotsLinkLinkIdDelete({ linkId }); } public deleteSnapshot({ snapshotId }: { snapshotId: string }) { - return this.cohereService.default.deleteSnapshotV1SnapshotsSnapshotIdDelete({ snapshotId }); + return this.cohereService.snapshot.deleteSnapshotV1SnapshotsSnapshotIdDelete({ snapshotId }); } private getEndpoint(endpoint: 'chat-stream' | 'google/auth' | 'oidc/auth') { diff --git a/src/interfaces/coral_web/src/cohere-client/generated/CohereClientGenerated.ts b/src/interfaces/coral_web/src/cohere-client/generated/CohereClientGenerated.ts index 12629cfe05..2babfefe9a 100644 --- a/src/interfaces/coral_web/src/cohere-client/generated/CohereClientGenerated.ts +++ b/src/interfaces/coral_web/src/cohere-client/generated/CohereClientGenerated.ts @@ -2,12 +2,36 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest'; import { FetchHttpRequest } from './core/FetchHttpRequest'; import type { OpenAPIConfig } from './core/OpenAPI'; import { Interceptors } from './core/OpenAPI'; +import { AgentService } from './services.gen'; +import { AuthService } from './services.gen'; +import { ChatService } from './services.gen'; +import { ConversationService } from './services.gen'; import { DefaultService } from './services.gen'; +import { DeploymentService } from './services.gen'; +import { ExperimentalFeaturesService } from './services.gen'; +import { ModelService } from './services.gen'; +import { OrganizationService } from './services.gen'; +import { ScimService } from './services.gen'; +import { SnapshotService } from './services.gen'; +import { ToolService } from './services.gen'; +import { UserService } from './services.gen'; type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; export class CohereClientGenerated { + public readonly agent: AgentService; + public readonly auth: AuthService; + public readonly chat: ChatService; + public readonly conversation: ConversationService; public readonly default: DefaultService; + public readonly deployment: DeploymentService; + public readonly experimentalFeatures: ExperimentalFeaturesService; + public readonly model: ModelService; + public readonly organization: OrganizationService; + public readonly scim: ScimService; + public readonly snapshot: SnapshotService; + public readonly tool: ToolService; + public readonly user: UserService; public readonly request: BaseHttpRequest; @@ -17,7 +41,7 @@ export class CohereClientGenerated { ) { this.request = new HttpRequest({ BASE: config?.BASE ?? '', - VERSION: config?.VERSION ?? '0.1.0', + VERSION: config?.VERSION ?? '1.1.5', WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false, CREDENTIALS: config?.CREDENTIALS ?? 'include', TOKEN: config?.TOKEN, @@ -31,6 +55,18 @@ export class CohereClientGenerated { }, }); + this.agent = new AgentService(this.request); + this.auth = new AuthService(this.request); + this.chat = new ChatService(this.request); + this.conversation = new ConversationService(this.request); this.default = new DefaultService(this.request); + this.deployment = new DeploymentService(this.request); + this.experimentalFeatures = new ExperimentalFeaturesService(this.request); + this.model = new ModelService(this.request); + this.organization = new OrganizationService(this.request); + this.scim = new ScimService(this.request); + this.snapshot = new SnapshotService(this.request); + this.tool = new ToolService(this.request); + this.user = new UserService(this.request); } } diff --git a/src/interfaces/coral_web/src/cohere-client/generated/core/OpenAPI.ts b/src/interfaces/coral_web/src/cohere-client/generated/core/OpenAPI.ts index be99f58378..85816ec430 100644 --- a/src/interfaces/coral_web/src/cohere-client/generated/core/OpenAPI.ts +++ b/src/interfaces/coral_web/src/cohere-client/generated/core/OpenAPI.ts @@ -47,7 +47,7 @@ export const OpenAPI: OpenAPIConfig = { PASSWORD: undefined, TOKEN: undefined, USERNAME: undefined, - VERSION: '0.1.0', + VERSION: '1.1.5', WITH_CREDENTIALS: false, interceptors: { request: new Interceptors(), diff --git a/src/interfaces/coral_web/src/cohere-client/generated/schemas.gen.ts b/src/interfaces/coral_web/src/cohere-client/generated/schemas.gen.ts index c69bcbd8bd..17b7d56694 100644 --- a/src/interfaces/coral_web/src/cohere-client/generated/schemas.gen.ts +++ b/src/interfaces/coral_web/src/cohere-client/generated/schemas.gen.ts @@ -4,29 +4,35 @@ export const $AgentPublic = { properties: { user_id: { type: 'string', - title: 'User Id', + title: 'User ID', + description: 'User ID for the Agent', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - version: { - type: 'integer', - title: 'Version', + title: 'Updated At Timestamp', + description: 'When the agent was updated', }, name: { type: 'string', title: 'Name', + description: 'Name of the Agent', + }, + version: { + type: 'integer', + title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -38,6 +44,7 @@ export const $AgentPublic = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -49,10 +56,12 @@ export const $AgentPublic = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { type: 'number', title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -67,6 +76,7 @@ export const $AgentPublic = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, tools_metadata: { anyOf: [ @@ -81,6 +91,7 @@ export const $AgentPublic = { }, ], title: 'Tools Metadata', + description: 'List of tool metadata for the Agent', }, deployment: { anyOf: [ @@ -92,6 +103,7 @@ export const $AgentPublic = { }, ], title: 'Deployment', + description: 'Deployment for the Agent', }, model: { anyOf: [ @@ -103,6 +115,7 @@ export const $AgentPublic = { }, ], title: 'Model', + description: 'Model for the Agent', }, is_private: { anyOf: [ @@ -114,42 +127,33 @@ export const $AgentPublic = { }, ], title: 'Is Private', + description: 'If the Agent is private', }, }, type: 'object', - required: [ - 'user_id', - 'id', - 'created_at', - 'updated_at', - 'version', - 'name', - 'description', - 'preamble', - 'temperature', - 'tools', - 'deployment', - 'model', - 'is_private', - ], + required: ['user_id', 'id', 'created_at', 'updated_at', 'name', 'version', 'temperature'], title: 'AgentPublic', + description: 'Public agent schema', } as const; export const $AgentToolMetadata = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent tool metadata ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent tool metadata was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the agent tool metadata was updated', }, user_id: { anyOf: [ @@ -160,15 +164,18 @@ export const $AgentToolMetadata = { type: 'null', }, ], - title: 'User Id', + title: 'User ID', + description: 'User ID for the agent tool metadata', }, agent_id: { type: 'string', - title: 'Agent Id', + title: 'Agent ID', + description: 'Agent ID for the agent tool metadata', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -176,36 +183,43 @@ export const $AgentToolMetadata = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', - required: ['id', 'created_at', 'updated_at', 'user_id', 'agent_id', 'tool_name', 'artifacts'], + required: ['id', 'created_at', 'updated_at', 'agent_id', 'tool_name', 'artifacts'], title: 'AgentToolMetadata', + description: 'Agent tool metadata schema', } as const; export const $AgentToolMetadataPublic = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Agent tool metadata ID', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the agent tool metadata was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the agent tool metadata was updated', }, agent_id: { type: 'string', - title: 'Agent Id', + title: 'Agent ID', + description: 'Agent ID for the agent tool metadata', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -213,17 +227,20 @@ export const $AgentToolMetadataPublic = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', required: ['id', 'created_at', 'updated_at', 'agent_id', 'tool_name', 'artifacts'], title: 'AgentToolMetadataPublic', + description: 'Public agent tool metadata schema', } as const; export const $AgentVisibility = { type: 'string', enum: ['private', 'public', 'all'], title: 'AgentVisibility', + description: 'Supported values for Agent Visibility', } as const; export const $Body_batch_upload_file_v1_agents_batch_upload_file_post = { @@ -266,7 +283,7 @@ export const $ChatMessage = { properties: { role: { $ref: '#/components/schemas/ChatRole', - title: 'One of CHATBOT|USER|SYSTEM to identify who the message is coming from.', + title: 'Role', }, message: { anyOf: [ @@ -277,7 +294,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Message', + description: 'Contents of the chat message.', }, tool_plan: { anyOf: [ @@ -288,7 +306,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Contents of the tool plan.', + title: 'Tool Plan', + description: 'Contents of the tool plan.', }, tool_results: { anyOf: [ @@ -302,7 +321,8 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'Results from the tool call.', + title: 'Tool Results', + description: 'Results from the tool call.', }, tool_calls: { anyOf: [ @@ -316,21 +336,23 @@ export const $ChatMessage = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', }, }, type: 'object', required: ['role'], title: 'ChatMessage', - description: - "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", + description: `A list of previous messages between the user and the model, meant to give the mode +conversational context for responding to the user's message.`, } as const; export const $ChatResponseEvent = { properties: { event: { $ref: '#/components/schemas/StreamEvent', - title: 'type of stream event', + title: 'Event', + description: 'Type of stream event', }, data: { anyOf: [ @@ -371,12 +393,14 @@ export const $ChatResponseEvent = { $ref: '#/components/schemas/NonStreamedChatResponse', }, ], - title: 'Data returned from chat response of a given event type', + title: 'Data', + description: 'Data returned from chat response of a given event type', }, }, type: 'object', required: ['event', 'data'], title: 'ChatResponseEvent', + description: 'Chat Response Event', } as const; export const $ChatRole = { @@ -391,26 +415,31 @@ export const $Citation = { text: { type: 'string', title: 'Text', + description: 'Citation text', }, start: { type: 'integer', title: 'Start', + description: 'Start position for the citation', }, end: { type: 'integer', title: 'End', + description: 'End position for the citation', }, document_ids: { items: { type: 'string', }, type: 'array', - title: 'Document Ids', + title: 'Document IDs', + description: 'Documents used for the citation', }, }, type: 'object', required: ['text', 'start', 'end', 'document_ids'], title: 'Citation', + description: 'Schema for a citation', } as const; export const $CohereChatPromptTruncation = { @@ -424,7 +453,8 @@ export const $CohereChatRequest = { properties: { message: { type: 'string', - title: 'The message to send to the chatbot.', + title: 'Message', + description: 'The message to send to the chatbot', }, chat_history: { anyOf: [ @@ -438,12 +468,14 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Chat History', + description: 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', }, conversation_id: { type: 'string', - title: + title: 'Conversation ID', + description: 'To store a conversation then create a conversation id and use it for every related request', }, tools: { @@ -458,7 +490,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: ` + title: 'Tools', + description: ` List of custom or managed tools to use for the response. If passing in managed tools, you only need to provide the name of the tool. If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. @@ -515,7 +548,8 @@ export const $CohereChatRequest = { type: 'object', }, type: 'array', - title: `Documents to use to generate grounded response with citations. Example: + title: 'Documents', + description: `Documents to use to generate grounded response with citations. Example: documents=[ { "id": "national_geographic_everest", @@ -541,7 +575,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'The model to use for generating the response.', + title: 'Model', + description: 'The model to use for generating the response.', default: 'command-r-plus', }, temperature: { @@ -554,7 +589,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Temperature', + description: 'A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.', }, k: { @@ -568,7 +604,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Top-K', + description: 'Ensures only the top k most likely tokens are considered for generation at each step.', }, p: { @@ -582,7 +619,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Top-P', + description: 'Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k.', }, preamble: { @@ -594,7 +632,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'A string to override the preamble.', + title: 'Preamble', + description: 'A string to override the preamble.', }, file_ids: { anyOf: [ @@ -608,7 +647,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'List of File IDs for PDFs used in RAG for the response.', + title: 'File IDs', + description: 'List of File IDs for PDFs used in RAG for the response.', }, search_queries_only: { anyOf: [ @@ -619,7 +659,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Search Queries Only', + description: "When set to true a list of search queries are generated. No search will occur nor replies to the user's message.", default: false, }, @@ -633,7 +674,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Max Tokens', + description: 'The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.', }, seed: { @@ -645,7 +687,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Seed', + description: 'If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.', }, stop_sequences: { @@ -660,7 +703,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Stop Sequences', + description: 'A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.', }, presence_penalty: { @@ -674,7 +718,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Presence Penalty', + description: 'Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.', }, frequency_penalty: { @@ -688,12 +733,22 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Frequency Penalty', + description: 'Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.', }, prompt_truncation: { - $ref: '#/components/schemas/CohereChatPromptTruncation', - title: "Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", + anyOf: [ + { + $ref: '#/components/schemas/CohereChatPromptTruncation', + }, + { + type: 'null', + }, + ], + title: 'Prompt Truncation', + description: + "Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", default: 'AUTO_PRESERVE_ORDER', }, tool_results: { @@ -708,7 +763,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Tool Results', + description: 'A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations.', }, force_single_step: { @@ -720,7 +776,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: + title: 'Force Single Step', + description: 'If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message.', }, agent_id: { @@ -732,7 +789,8 @@ export const $CohereChatRequest = { type: 'null', }, ], - title: 'The agent ID to use for the chat.', + title: 'Agent ID', + description: 'The agent ID to use for the chat.', }, }, type: 'object', @@ -746,61 +804,73 @@ export const $ConversationFilePublic = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'ConversationFilePublic', + description: 'Schema for a public conversation file', } as const; export const $ConversationPublic = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the conversation', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the conversation was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the conversation was updated', }, title: { type: 'string', title: 'Title', + description: 'Title of the conversation', }, messages: { items: { @@ -808,6 +878,7 @@ export const $ConversationPublic = { }, type: 'array', title: 'Messages', + description: 'The conversation messages', }, files: { items: { @@ -815,6 +886,7 @@ export const $ConversationPublic = { }, type: 'array', title: 'Files', + description: 'List of files for the conversation', }, description: { anyOf: [ @@ -826,6 +898,7 @@ export const $ConversationPublic = { }, ], title: 'Description', + description: 'Description of the conversation', }, agent_id: { anyOf: [ @@ -836,11 +909,13 @@ export const $ConversationPublic = { type: 'null', }, ], - title: 'Agent Id', + title: 'Agent ID', + description: 'Unique identifier for the agent used in the conversation', }, is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, total_file_size: { type: 'integer', @@ -856,33 +931,36 @@ export const $ConversationPublic = { 'title', 'messages', 'files', - 'description', - 'agent_id', 'is_pinned', 'total_file_size', ], title: 'ConversationPublic', + description: 'A public conversation which removes the User ID and Organization ID', } as const; export const $ConversationWithoutMessages = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the conversation', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the conversation was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the conversation was updated', }, title: { type: 'string', title: 'Title', + description: 'Title of the conversation', }, files: { items: { @@ -890,6 +968,7 @@ export const $ConversationWithoutMessages = { }, type: 'array', title: 'Files', + description: 'List of files for the conversation', }, description: { anyOf: [ @@ -901,6 +980,7 @@ export const $ConversationWithoutMessages = { }, ], title: 'Description', + description: 'Description of the conversation', }, agent_id: { anyOf: [ @@ -911,11 +991,13 @@ export const $ConversationWithoutMessages = { type: 'null', }, ], - title: 'Agent Id', + title: 'Agent ID', + description: 'Unique identifier for the agent used in the conversation', }, is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, total_file_size: { type: 'integer', @@ -924,18 +1006,9 @@ export const $ConversationWithoutMessages = { }, }, type: 'object', - required: [ - 'id', - 'created_at', - 'updated_at', - 'title', - 'files', - 'description', - 'agent_id', - 'is_pinned', - 'total_file_size', - ], + required: ['id', 'created_at', 'updated_at', 'title', 'files', 'is_pinned', 'total_file_size'], title: 'ConversationWithoutMessages', + description: 'A public conversation without messages attached', } as const; export const $CreateAgentRequest = { @@ -943,6 +1016,7 @@ export const $CreateAgentRequest = { name: { type: 'string', title: 'Name', + description: 'Name of the Agent', }, version: { anyOf: [ @@ -954,6 +1028,7 @@ export const $CreateAgentRequest = { }, ], title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -965,6 +1040,7 @@ export const $CreateAgentRequest = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -976,6 +1052,7 @@ export const $CreateAgentRequest = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { anyOf: [ @@ -987,6 +1064,7 @@ export const $CreateAgentRequest = { }, ], title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -1001,6 +1079,7 @@ export const $CreateAgentRequest = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, tools_metadata: { anyOf: [ @@ -1015,6 +1094,12 @@ export const $CreateAgentRequest = { }, ], title: 'Tools Metadata', + description: 'Tools metadata for the Agent', + }, + deployment: { + type: 'string', + title: 'Deployment', + description: 'Deployment for the Agent', }, deployment_config: { anyOf: [ @@ -1029,14 +1114,12 @@ export const $CreateAgentRequest = { }, ], title: 'Deployment Config', + description: 'Deployment config for the Agent', }, model: { type: 'string', title: 'Model', - }, - deployment: { - type: 'string', - title: 'Deployment', + description: 'Model for the Agent', }, organization_id: { anyOf: [ @@ -1047,7 +1130,8 @@ export const $CreateAgentRequest = { type: 'null', }, ], - title: 'Organization Id', + title: 'Organization ID', + description: 'Organization ID for the Agent', }, is_private: { anyOf: [ @@ -1059,12 +1143,14 @@ export const $CreateAgentRequest = { }, ], title: 'Is Private', + description: 'If the Agent is private', default: false, }, }, type: 'object', - required: ['name', 'model', 'deployment'], + required: ['name', 'deployment', 'model'], title: 'CreateAgentRequest', + description: 'Schema to create an agent', } as const; export const $CreateAgentToolMetadataRequest = { @@ -1078,11 +1164,13 @@ export const $CreateAgentToolMetadataRequest = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Agent Tool Metadata ID', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { items: { @@ -1090,11 +1178,13 @@ export const $CreateAgentToolMetadataRequest = { }, type: 'array', title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', required: ['tool_name', 'artifacts'], title: 'CreateAgentToolMetadataRequest', + description: 'Request to create Agent Tool Metadata', } as const; export const $CreateGroup = { @@ -1105,6 +1195,7 @@ export const $CreateGroup = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the group', }, members: { items: { @@ -1112,10 +1203,12 @@ export const $CreateGroup = { }, type: 'array', title: 'Members', + description: 'Members of the group', }, displayName: { type: 'string', - title: 'Displayname', + title: 'Display Name', + description: 'Display name for the group', }, }, type: 'object', @@ -1128,34 +1221,40 @@ export const $CreateOrganization = { name: { type: 'string', title: 'Name', + description: 'Name of the organization', }, }, type: 'object', required: ['name'], title: 'CreateOrganization', + description: 'Request to create an organization', } as const; export const $CreateSnapshotRequest = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, }, type: 'object', required: ['conversation_id'], title: 'CreateSnapshotRequest', + description: 'Request to create a snapshot', } as const; export const $CreateSnapshotResponse = { properties: { snapshot_id: { type: 'string', - title: 'Snapshot Id', + title: 'Snapshot ID', + description: 'Unique identifier for the snapshot', }, link_id: { type: 'string', - title: 'Link Id', + title: 'Link ID', + description: 'Unique identifier for the link', }, messages: { items: { @@ -1163,83 +1262,97 @@ export const $CreateSnapshotResponse = { }, type: 'array', title: 'Messages', + description: 'List of messages', }, }, type: 'object', required: ['snapshot_id', 'link_id', 'messages'], title: 'CreateSnapshotResponse', + description: 'Response for creating a snapshot', } as const; export const $DeleteAgent = { properties: {}, type: 'object', title: 'DeleteAgent', + description: 'Response for deleting an agent', } as const; export const $DeleteAgentFileResponse = { properties: {}, type: 'object', title: 'DeleteAgentFileResponse', + description: 'Response for deleting an agent file', } as const; export const $DeleteAgentToolMetadata = { properties: {}, type: 'object', title: 'DeleteAgentToolMetadata', + description: 'Delete agent tool metadata response', } as const; export const $DeleteConversationFileResponse = { properties: {}, type: 'object', title: 'DeleteConversationFileResponse', + description: 'Response for deleting a conversation file', } as const; export const $DeleteConversationResponse = { properties: {}, type: 'object', title: 'DeleteConversationResponse', + description: 'Response for deleting a conversation', } as const; export const $DeleteDeployment = { properties: {}, type: 'object', title: 'DeleteDeployment', + description: 'Delete Deployment Response', } as const; export const $DeleteModel = { properties: {}, type: 'object', title: 'DeleteModel', + description: 'Response for deleting a model', } as const; export const $DeleteOrganization = { properties: {}, type: 'object', title: 'DeleteOrganization', + description: 'Response when deleting organization', } as const; export const $DeleteSnapshotLinkResponse = { properties: {}, type: 'object', title: 'DeleteSnapshotLinkResponse', + description: 'Response for deleting a snapshot link', } as const; export const $DeleteSnapshotResponse = { properties: {}, type: 'object', title: 'DeleteSnapshotResponse', + description: 'Response for deleting a snapshot', } as const; export const $DeleteToolAuth = { properties: {}, type: 'object', title: 'DeleteToolAuth', + description: 'Response when deleting a tool auth', } as const; export const $DeleteUser = { properties: {}, type: 'object', title: 'DeleteUser', + description: 'Response when deleting a user', } as const; export const $DeploymentCreate = { @@ -1253,11 +1366,13 @@ export const $DeploymentCreate = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Unique Identifier for the Deployment', }, name: { type: 'string', title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1269,14 +1384,17 @@ export const $DeploymentCreate = { }, ], title: 'Description', + description: 'Description of the deployment', }, deployment_class_name: { type: 'string', title: 'Deployment Class Name', + description: 'Deployment Class Name', }, is_community: { type: 'boolean', title: 'Is Community', + description: 'Is the deployment from the commmunity', default: false, }, default_deployment_config: { @@ -1285,22 +1403,26 @@ export const $DeploymentCreate = { }, type: 'object', title: 'Default Deployment Config', + description: 'The default deployment configuration', }, }, type: 'object', required: ['name', 'deployment_class_name', 'default_deployment_config'], title: 'DeploymentCreate', + description: 'Deployment Create Schema', } as const; export const $DeploymentDefinition = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique Identifier for the Deployment', }, name: { type: 'string', title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1312,6 +1434,7 @@ export const $DeploymentDefinition = { }, ], title: 'Description', + description: 'Description of the deployment', }, config: { additionalProperties: { @@ -1319,16 +1442,26 @@ export const $DeploymentDefinition = { }, type: 'object', title: 'Config', + description: 'Config for the deployment', default: {}, }, is_available: { type: 'boolean', title: 'Is Available', + description: 'Is deployment is available', default: false, }, is_community: { - type: 'boolean', + anyOf: [ + { + type: 'boolean', + }, + { + type: 'null', + }, + ], title: 'Is Community', + description: 'Is the deployment from the commmunity', default: false, }, models: { @@ -1337,15 +1470,18 @@ export const $DeploymentDefinition = { }, type: 'array', title: 'Models', + description: 'List of models for the deployment', }, class_name: { type: 'string', title: 'Class Name', + description: 'Deployment class name', }, }, type: 'object', required: ['id', 'name', 'models', 'class_name'], title: 'DeploymentDefinition', + description: 'Deployment Definition', } as const; export const $DeploymentUpdate = { @@ -1360,6 +1496,7 @@ export const $DeploymentUpdate = { }, ], title: 'Name', + description: 'Name of the Deployment', }, description: { anyOf: [ @@ -1371,6 +1508,7 @@ export const $DeploymentUpdate = { }, ], title: 'Description', + description: 'Description of the deployment', }, deployment_class_name: { anyOf: [ @@ -1382,6 +1520,7 @@ export const $DeploymentUpdate = { }, ], title: 'Deployment Class Name', + description: 'Deployment Class Name', }, is_community: { anyOf: [ @@ -1393,6 +1532,7 @@ export const $DeploymentUpdate = { }, ], title: 'Is Community', + description: 'Is the deployment from the commmunity', }, default_deployment_config: { anyOf: [ @@ -1407,10 +1547,12 @@ export const $DeploymentUpdate = { }, ], title: 'Default Deployment Config', + description: 'The default deployment configuration', }, }, type: 'object', title: 'DeploymentUpdate', + description: 'Deployment Update Schema', } as const; export const $Document = { @@ -1418,10 +1560,12 @@ export const $Document = { text: { type: 'string', title: 'Text', + description: 'Document text', }, document_id: { type: 'string', - title: 'Document Id', + title: 'Document_Id', + description: 'Unique Identifier for the document', }, title: { anyOf: [ @@ -1433,6 +1577,7 @@ export const $Document = { }, ], title: 'Title', + description: 'Document title', }, url: { anyOf: [ @@ -1443,7 +1588,8 @@ export const $Document = { type: 'null', }, ], - title: 'Url', + title: 'URL', + description: 'Document URL', }, fields: { anyOf: [ @@ -1455,6 +1601,7 @@ export const $Document = { }, ], title: 'Fields', + description: 'Document Fields', }, tool_name: { anyOf: [ @@ -1466,11 +1613,13 @@ export const $Document = { }, ], title: 'Tool Name', + description: 'Tool name for the document', }, }, type: 'object', - required: ['text', 'document_id', 'title', 'url', 'fields', 'tool_name'], + required: ['text', 'document_id'], title: 'Document', + description: 'Schema for a Document', } as const; export const $Email = { @@ -1478,6 +1627,7 @@ export const $Email = { primary: { type: 'boolean', title: 'Primary', + description: 'Is email the primary email', }, value: { anyOf: [ @@ -1489,10 +1639,12 @@ export const $Email = { }, ], title: 'Value', + description: 'Email value', }, type: { type: 'string', title: 'Type', + description: 'Type of email', }, }, type: 'object', @@ -1504,36 +1656,43 @@ export const $FileMetadata = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the file', }, - file_name: { + created_at: { type: 'string', - title: 'File Name', + format: 'date-time', + title: 'Created At Timestamp', + description: 'When file was created', }, - file_content: { + updated_at: { type: 'string', - title: 'File Content', + format: 'date-time', + title: 'Updated At Timestamp', + description: 'When file was updated', + }, + file_name: { + type: 'string', + title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, - created_at: { - type: 'string', - format: 'date-time', - title: 'Created At', - }, - updated_at: { + file_content: { type: 'string', - format: 'date-time', - title: 'Updated At', + title: 'File Content', + description: 'The contents of the file', }, }, type: 'object', - required: ['id', 'file_name', 'file_content', 'created_at', 'updated_at'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'file_content'], title: 'FileMetadata', + description: 'Schema for file metadata', } as const; export const $GenerateTitleResponse = { @@ -1541,6 +1700,7 @@ export const $GenerateTitleResponse = { title: { type: 'string', title: 'Title', + description: 'Title generated for the conversation', }, error: { anyOf: [ @@ -1552,11 +1712,13 @@ export const $GenerateTitleResponse = { }, ], title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', required: ['title'], title: 'GenerateTitleResponse', + description: 'Response for generating a title', } as const; export const $Group = { @@ -1567,6 +1729,7 @@ export const $Group = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the group', }, members: { items: { @@ -1574,17 +1737,21 @@ export const $Group = { }, type: 'array', title: 'Members', + description: 'Members of the group', }, displayName: { type: 'string', - title: 'Displayname', + title: 'Display Name', + description: 'Display name for the group', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the group', }, meta: { $ref: '#/components/schemas/Meta', + description: 'Metadata for the group', }, }, type: 'object', @@ -1597,10 +1764,12 @@ export const $GroupMember = { value: { type: 'string', title: 'Value', + description: 'Value', }, display: { type: 'string', title: 'Display', + description: 'Display', }, }, type: 'object', @@ -1613,6 +1782,7 @@ export const $GroupOperation = { op: { type: 'string', title: 'Op', + description: 'Op', }, path: { anyOf: [ @@ -1624,6 +1794,7 @@ export const $GroupOperation = { }, ], title: 'Path', + description: 'Path', }, value: { anyOf: [ @@ -1644,6 +1815,7 @@ export const $GroupOperation = { }, ], title: 'Value', + description: 'Value', }, }, type: 'object', @@ -1670,11 +1842,13 @@ export const $JWTResponse = { token: { type: 'string', title: 'Token', + description: 'JSON Web Token', }, }, type: 'object', required: ['token'], title: 'JWTResponse', + description: 'JWT Response', } as const; export const $ListAuthStrategy = { @@ -1682,6 +1856,7 @@ export const $ListAuthStrategy = { strategy: { type: 'string', title: 'Strategy', + description: 'Auth strategy name', }, client_id: { anyOf: [ @@ -1692,7 +1867,8 @@ export const $ListAuthStrategy = { type: 'null', }, ], - title: 'Client Id', + title: 'Client ID', + description: 'Client ID to be used', }, authorization_endpoint: { anyOf: [ @@ -1704,70 +1880,84 @@ export const $ListAuthStrategy = { }, ], title: 'Authorization Endpoint', + description: 'The endpoint for authorization', }, pkce_enabled: { type: 'boolean', - title: 'Pkce Enabled', + title: 'PKCE Enabled', + description: 'If PKCE is enabled', }, }, type: 'object', - required: ['strategy', 'client_id', 'authorization_endpoint', 'pkce_enabled'], + required: ['strategy', 'pkce_enabled'], title: 'ListAuthStrategy', + description: 'List Auth Strategy', } as const; export const $ListConversationFile = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'ListConversationFile', + description: 'Listing conversation files', } as const; export const $ListGroupResponse = { properties: { totalResults: { type: 'integer', - title: 'Totalresults', + title: 'Total Results', + description: 'Total results available', }, startIndex: { type: 'integer', - title: 'Startindex', + title: 'Start Index', + description: 'Start index for returned results', }, itemsPerPage: { type: 'integer', - title: 'Itemsperpage', + title: 'Items Per Page', + description: 'Total results returned in the request', }, Resources: { items: { @@ -1775,6 +1965,7 @@ export const $ListGroupResponse = { }, type: 'array', title: 'Resources', + description: 'List of Groups', }, }, type: 'object', @@ -1786,15 +1977,18 @@ export const $ListUserResponse = { properties: { totalResults: { type: 'integer', - title: 'Totalresults', + title: 'Total Results', + description: 'Total results available', }, startIndex: { type: 'integer', - title: 'Startindex', + title: 'Start Index', + description: 'Start index for returned results', }, itemsPerPage: { type: 'integer', - title: 'Itemsperpage', + title: 'Items Per Page', + description: 'Total results returned in the request', }, Resources: { items: { @@ -1802,6 +1996,7 @@ export const $ListUserResponse = { }, type: 'array', title: 'Resources', + description: 'List of Users', }, }, type: 'object', @@ -1814,6 +2009,7 @@ export const $Login = { strategy: { type: 'string', title: 'Strategy', + description: 'Auth strategy to use', }, payload: { anyOf: [ @@ -1828,17 +2024,20 @@ export const $Login = { }, ], title: 'Payload', + description: 'Login payload depending on strategy used', }, }, type: 'object', required: ['strategy'], title: 'Login', + description: 'Login Request', } as const; export const $Logout = { properties: {}, type: 'object', title: 'Logout', + description: 'Logout Request', } as const; export const $Message = { @@ -1846,20 +2045,24 @@ export const $Message = { text: { type: 'string', title: 'Text', + description: 'The text content of the message', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the message', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When message was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When message was updated', }, generation_id: { anyOf: [ @@ -1870,15 +2073,18 @@ export const $Message = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Generation ID for the message', }, position: { type: 'integer', title: 'Position', + description: 'Position in the conversation', }, is_active: { type: 'boolean', title: 'Is Active', + description: 'Is the message active', }, documents: { items: { @@ -1886,6 +2092,7 @@ export const $Message = { }, type: 'array', title: 'Documents', + description: 'Documents associated with the message', }, citations: { items: { @@ -1893,6 +2100,7 @@ export const $Message = { }, type: 'array', title: 'Citations', + description: 'Citations associated with the message', }, files: { items: { @@ -1900,6 +2108,7 @@ export const $Message = { }, type: 'array', title: 'Files', + description: 'Files associated with the message', }, tool_calls: { items: { @@ -1907,6 +2116,7 @@ export const $Message = { }, type: 'array', title: 'Tool Calls', + description: 'Tool calls associated with the message', }, tool_plan: { anyOf: [ @@ -1918,9 +2128,12 @@ export const $Message = { }, ], title: 'Tool Plan', + description: 'Tool plan associated with the message', }, agent: { $ref: '#/components/schemas/MessageAgent', + title: 'Agent', + description: 'Agent associated with the message', }, }, type: 'object', @@ -1929,17 +2142,16 @@ export const $Message = { 'id', 'created_at', 'updated_at', - 'generation_id', 'position', 'is_active', 'documents', 'citations', 'files', 'tool_calls', - 'tool_plan', 'agent', ], title: 'Message', + description: 'Message Schema', } as const; export const $MessageAgent = { @@ -1952,35 +2164,32 @@ export const $Meta = { properties: { resourceType: { type: 'string', - title: 'Resourcetype', + title: 'Resource Type', + description: 'Type of resource the metadata is for', }, created: { type: 'string', title: 'Created', + description: 'When metadata was created', }, lastModified: { type: 'string', - title: 'Lastmodified', + title: 'Last Modified', + description: 'When metadata was last modified', }, }, type: 'object', required: ['resourceType', 'created', 'lastModified'], title: 'Meta', + description: 'Schema for metadata', } as const; export const $Model = { properties: { - id: { - type: 'string', - title: 'Id', - }, name: { type: 'string', title: 'Name', - }, - deployment_id: { - type: 'string', - title: 'Deployment Id', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -1992,6 +2201,7 @@ export const $Model = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2003,10 +2213,21 @@ export const $Model = { }, ], title: 'Description', + description: 'Model description', + }, + id: { + type: 'string', + title: 'ID', + description: 'Unique identifier for the model', + }, + deployment_id: { + type: 'string', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', - required: ['id', 'name', 'deployment_id', 'cohere_name', 'description'], + required: ['name', 'id', 'deployment_id'], title: 'Model', } as const; @@ -2015,6 +2236,7 @@ export const $ModelCreate = { name: { type: 'string', title: 'Name', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -2026,6 +2248,7 @@ export const $ModelCreate = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2037,14 +2260,16 @@ export const $ModelCreate = { }, ], title: 'Description', + description: 'Model description', }, deployment_id: { type: 'string', - title: 'Deployment Id', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', - required: ['name', 'cohere_name', 'description', 'deployment_id'], + required: ['name', 'deployment_id'], title: 'ModelCreate', } as const; @@ -2060,6 +2285,7 @@ export const $ModelUpdate = { }, ], title: 'Name', + description: 'Model name', }, cohere_name: { anyOf: [ @@ -2071,6 +2297,7 @@ export const $ModelUpdate = { }, ], title: 'Cohere Name', + description: 'Cohere model name', }, description: { anyOf: [ @@ -2082,6 +2309,7 @@ export const $ModelUpdate = { }, ], title: 'Description', + description: 'Model description', }, deployment_id: { anyOf: [ @@ -2092,7 +2320,8 @@ export const $ModelUpdate = { type: 'null', }, ], - title: 'Deployment Id', + title: 'Deployment ID', + description: 'Unique identifier for the deployment', }, }, type: 'object', @@ -2103,11 +2332,13 @@ export const $Name = { properties: { givenName: { type: 'string', - title: 'Givenname', + title: 'Given Name', + description: "User's given name", }, familyName: { type: 'string', - title: 'Familyname', + title: 'Family Name', + description: "User's family name", }, }, type: 'object', @@ -2126,7 +2357,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Unique identifier for the response.', + title: 'Response ID', + description: 'Unique identifier for the response', }, generation_id: { anyOf: [ @@ -2137,7 +2369,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Unique identifier for the generation.', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, chat_history: { anyOf: [ @@ -2151,16 +2384,19 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: + title: 'Chat History', + description: "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", }, finish_reason: { type: 'string', - title: 'Reason the chat stream ended.', + title: 'Finish Reason', + description: 'Reason the chat stream ended', }, text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, citations: { anyOf: [ @@ -2174,7 +2410,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat message', default: [], }, documents: { @@ -2189,7 +2426,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, search_results: { @@ -2204,7 +2442,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, search_queries: { @@ -2219,7 +2458,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'List of generated search queries.', + title: 'Search Queries', + description: 'List of generated search queries.', default: [], }, conversation_id: { @@ -2231,8 +2471,9 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: - 'To store a conversation then create a conversation id and use it for every related request.', + title: 'Conversation ID', + description: + 'To store a conversation then create a conversation id and use it for every related request', }, tool_calls: { anyOf: [ @@ -2246,7 +2487,8 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, error: { @@ -2258,19 +2500,14 @@ export const $NonStreamedChatResponse = { type: 'null', }, ], - title: 'Error message if the response is an error.', + title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', - required: [ - 'response_id', - 'generation_id', - 'chat_history', - 'finish_reason', - 'text', - 'conversation_id', - ], + required: ['finish_reason', 'text'], title: 'NonStreamedChatResponse', + description: 'Non streamed chat response', } as const; export const $Operation = { @@ -2278,6 +2515,7 @@ export const $Operation = { op: { type: 'string', title: 'Op', + description: 'Op', }, value: { additionalProperties: { @@ -2285,6 +2523,7 @@ export const $Operation = { }, type: 'object', title: 'Value', + description: 'Value', }, }, type: 'object', @@ -2297,25 +2536,30 @@ export const $Organization = { name: { type: 'string', title: 'Name', + description: 'Name of the organization', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the organization', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When organization was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When organization was updated', }, }, type: 'object', required: ['name', 'id', 'created_at', 'updated_at'], title: 'Organization', + description: 'Schema for an organization', } as const; export const $PatchGroup = { @@ -2326,6 +2570,7 @@ export const $PatchGroup = { }, type: 'array', title: 'Schemas', + description: 'Schemas for group', }, operations: { items: { @@ -2333,6 +2578,7 @@ export const $PatchGroup = { }, type: 'array', title: 'Operations', + description: 'Operations for the group', }, }, type: 'object', @@ -2348,6 +2594,7 @@ export const $PatchUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for user', }, operations: { items: { @@ -2355,6 +2602,7 @@ export const $PatchUser = { }, type: 'array', title: 'Operations', + description: 'Operations for the user', }, }, type: 'object', @@ -2367,15 +2615,18 @@ export const $SearchQuery = { text: { type: 'string', title: 'Text', + description: 'Text for the search', }, generation_id: { type: 'string', - title: 'Generation Id', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, }, type: 'object', required: ['text', 'generation_id'], title: 'SearchQuery', + description: 'Schema for search query', } as const; export const $SnapshotData = { @@ -2383,10 +2634,12 @@ export const $SnapshotData = { title: { type: 'string', title: 'Title', + description: 'Title of the snapshot', }, description: { type: 'string', title: 'Description', + description: 'Description of the snapshot', }, messages: { items: { @@ -2394,43 +2647,53 @@ export const $SnapshotData = { }, type: 'array', title: 'Messages', + description: 'List of messages', }, }, type: 'object', required: ['title', 'description', 'messages'], title: 'SnapshotData', + description: 'Snapshot data', } as const; export const $SnapshotPublic = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the snapshot', }, last_message_id: { type: 'string', - title: 'Last Message Id', + title: 'Last Message ID', + description: 'Unique identifier for the last message', }, version: { type: 'integer', title: 'Version', + description: 'Snapshot version', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When snapshot was creted', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When snapshot was updated', }, snapshot: { $ref: '#/components/schemas/SnapshotData', + title: 'Snapshot Data', + description: 'Data for the snapshot', }, }, type: 'object', @@ -2444,38 +2707,47 @@ export const $SnapshotPublic = { 'snapshot', ], title: 'SnapshotPublic', + description: 'Public snapshot', } as const; export const $SnapshotWithLinks = { properties: { conversation_id: { type: 'string', - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the snapshot', }, last_message_id: { type: 'string', - title: 'Last Message Id', + title: 'Last Message ID', + description: 'Unique identifier for the last message', }, version: { type: 'integer', title: 'Version', + description: 'Snapshot version', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When snapshot was creted', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When snapshot was updated', }, snapshot: { $ref: '#/components/schemas/SnapshotData', + title: 'Snapshot Data', + description: 'Data for the snapshot', }, links: { items: { @@ -2483,6 +2755,7 @@ export const $SnapshotWithLinks = { }, type: 'array', title: 'Links', + description: 'List of links', }, }, type: 'object', @@ -2497,6 +2770,7 @@ export const $SnapshotWithLinks = { 'links', ], title: 'SnapshotWithLinks', + description: 'Snapshot with links', } as const; export const $StreamCitationGeneration = { @@ -2506,13 +2780,14 @@ export const $StreamCitationGeneration = { $ref: '#/components/schemas/Citation', }, type: 'array', - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat message', default: [], }, }, type: 'object', title: 'StreamCitationGeneration', - description: 'Stream citation generation event.', + description: 'Stream citation generation event', } as const; export const $StreamEnd = { @@ -2526,7 +2801,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Message Id', + title: 'Message ID', + description: 'Unique identifier for the message', }, response_id: { anyOf: [ @@ -2537,7 +2813,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Response Id', + title: 'Response ID', + description: 'Unique identifier for the response', }, generation_id: { anyOf: [ @@ -2548,7 +2825,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Unique identifier for the generation', }, conversation_id: { anyOf: [ @@ -2559,18 +2837,21 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Unique identifier for the conversation', }, text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, citations: { items: { $ref: '#/components/schemas/Citation', }, type: 'array', - title: 'Citations for the chat message.', + title: 'Citations', + description: 'Citations for the chat messae.', default: [], }, documents: { @@ -2578,7 +2859,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, search_results: { @@ -2586,7 +2868,8 @@ export const $StreamEnd = { type: 'object', }, type: 'array', - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, search_queries: { @@ -2594,7 +2877,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/SearchQuery', }, type: 'array', - title: 'List of generated search queries.', + title: 'Search Queries', + description: 'List of generated search queries', default: [], }, tool_calls: { @@ -2602,7 +2886,8 @@ export const $StreamEnd = { $ref: '#/components/schemas/ToolCall', }, type: 'array', - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, finish_reason: { @@ -2615,6 +2900,7 @@ export const $StreamEnd = { }, ], title: 'Finish Reason', + description: 'Reson why the model finished the request', }, chat_history: { anyOf: [ @@ -2628,7 +2914,8 @@ export const $StreamEnd = { type: 'null', }, ], - title: + title: 'Chat History', + description: 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', }, error: { @@ -2640,12 +2927,14 @@ export const $StreamEnd = { type: 'null', }, ], - title: 'Error message if the response is an error.', + title: 'Error', + description: 'Error message if the response is an error', }, }, type: 'object', required: ['text'], title: 'StreamEnd', + description: 'Stream end generation event', } as const; export const $StreamEvent = { @@ -2671,13 +2960,14 @@ export const $StreamQueryGeneration = { properties: { query: { type: 'string', - title: 'Search query used to generate grounded response with citations.', + title: 'Query', + description: 'Search query used to generate grounded response with citations', }, }, type: 'object', required: ['query'], title: 'StreamQueryGeneration', - description: 'Stream query generation event.', + description: 'Stream query generation event', } as const; export const $StreamSearchQueriesGeneration = { @@ -2687,13 +2977,14 @@ export const $StreamSearchQueriesGeneration = { $ref: '#/components/schemas/SearchQuery', }, type: 'array', - title: 'Search query used to generate grounded response with citations.', + title: 'Search Queries', + description: 'Search query used to generate grounded response with citations', default: [], }, }, type: 'object', title: 'StreamSearchQueriesGeneration', - description: 'Stream queries generation event.', + description: 'Stream queries generation event', } as const; export const $StreamSearchResults = { @@ -2703,7 +2994,8 @@ export const $StreamSearchResults = { type: 'object', }, type: 'array', - title: 'Search results used to generate grounded response with citations.', + title: 'Search Results', + description: 'Search results used to generate grounded response with citations', default: [], }, documents: { @@ -2711,12 +3003,14 @@ export const $StreamSearchResults = { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, }, type: 'object', title: 'StreamSearchResults', + description: 'Stream search generation event', } as const; export const $StreamStart = { @@ -2730,7 +3024,8 @@ export const $StreamStart = { type: 'null', }, ], - title: 'Generation Id', + title: 'Generation ID', + description: 'Generation ID for the event', }, conversation_id: { anyOf: [ @@ -2741,25 +3036,27 @@ export const $StreamStart = { type: 'null', }, ], - title: 'Conversation Id', + title: 'Conversation ID', + description: 'Conversation ID for the event', }, }, type: 'object', title: 'StreamStart', - description: 'Stream start event.', + description: 'Stream start event', } as const; export const $StreamTextGeneration = { properties: { text: { type: 'string', - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', required: ['text'], title: 'StreamTextGeneration', - description: 'Stream text generation event.', + description: 'Stream text generation event', } as const; export const $StreamToolCallsChunk = { @@ -2773,7 +3070,8 @@ export const $StreamToolCallsChunk = { type: 'null', }, ], - title: 'Partial tool call', + title: 'Tool Call Delta', + description: 'Partial tool call', default: {}, }, text: { @@ -2785,12 +3083,13 @@ export const $StreamToolCallsChunk = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', - required: ['text'], title: 'StreamToolCallsChunk', + description: 'Stream tool call chunk generated event', } as const; export const $StreamToolCallsGeneration = { @@ -2804,8 +3103,8 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'List of search results used to generate grounded response with citations', - default: [], + title: 'Stream Search Results', + description: 'Search results used to generate grounded response with citations', }, tool_calls: { anyOf: [ @@ -2819,7 +3118,8 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'List of tool calls generated for custom tools', + title: 'Tool Calls', + description: 'List of tool calls generated for custom tools', default: [], }, text: { @@ -2831,59 +3131,69 @@ export const $StreamToolCallsGeneration = { type: 'null', }, ], - title: 'Contents of the chat message.', + title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', - required: ['text'], title: 'StreamToolCallsGeneration', - description: 'Stream tool calls generation event.', + description: 'Stream tool calls generation event', } as const; export const $StreamToolInput = { properties: { input_type: { $ref: '#/components/schemas/ToolInputType', + title: 'Input Type', + description: 'Tool input type', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Name of the tool to be used', }, input: { type: 'string', title: 'Input', + description: 'Tool input', }, text: { type: 'string', title: 'Text', + description: 'Contents of the chat message', }, }, type: 'object', required: ['input_type', 'tool_name', 'input', 'text'], title: 'StreamToolInput', + description: 'Stream tool input generation event', } as const; export const $StreamToolResult = { properties: { result: { title: 'Result', + description: 'Result from the tool', }, tool_name: { type: 'string', title: 'Tool Name', + description: 'Name of tool that generated the result', }, documents: { items: { $ref: '#/components/schemas/Document', }, type: 'array', - title: 'Documents used to generate grounded response with citations.', + title: 'Documents', + description: 'Documents used to generate grounded response with citations', default: [], }, }, type: 'object', required: ['result', 'tool_name'], title: 'StreamToolResult', + description: 'Stream tool result generation event', } as const; export const $ToggleConversationPinRequest = { @@ -2891,11 +3201,13 @@ export const $ToggleConversationPinRequest = { is_pinned: { type: 'boolean', title: 'Is Pinned', + description: 'If conversation is pinned', }, }, type: 'object', required: ['is_pinned'], title: 'ToggleConversationPinRequest', + description: 'Request to toggle pinning a conversation', } as const; export const $Tool = { @@ -2910,6 +3222,7 @@ export const $Tool = { }, ], title: 'Name', + description: 'Name of the Tool', default: '', }, parameter_definitions: { @@ -2922,11 +3235,13 @@ export const $Tool = { }, ], title: 'Parameter Definitions', + description: 'Parameters definitions for the tool', default: {}, }, }, type: 'object', title: 'Tool', + description: 'Tool Schema', } as const; export const $ToolCall = { @@ -2934,16 +3249,19 @@ export const $ToolCall = { name: { type: 'string', title: 'Name', + description: 'Name of the Tool', }, parameters: { type: 'object', title: 'Parameters', + description: 'Parameters for the tool call', default: {}, }, }, type: 'object', required: ['name'], title: 'ToolCall', + description: 'Schema for Tool Call', } as const; export const $ToolCallDelta = { @@ -2958,6 +3276,7 @@ export const $ToolCallDelta = { }, ], title: 'Name', + description: 'Name of the Tool', }, index: { anyOf: [ @@ -2969,6 +3288,7 @@ export const $ToolCallDelta = { }, ], title: 'Index', + description: 'Index', }, parameters: { anyOf: [ @@ -2980,17 +3300,19 @@ export const $ToolCallDelta = { }, ], title: 'Parameters', + description: 'Parameters for the tool call', }, }, type: 'object', - required: ['name', 'index', 'parameters'], title: 'ToolCallDelta', + description: 'Schema for Tool Call Delta', } as const; export const $ToolCategory = { type: 'string', enum: ['Data loader', 'File loader', 'Function', 'Web search'], title: 'ToolCategory', + description: 'Supported Tool Categories', } as const; export const $ToolDefinition = { @@ -3005,6 +3327,7 @@ export const $ToolDefinition = { }, ], title: 'Name', + description: 'Name of the Tool', default: '', }, parameter_definitions: { @@ -3017,16 +3340,19 @@ export const $ToolDefinition = { }, ], title: 'Parameter Definitions', + description: 'Parameters definitions for the tool', default: {}, }, display_name: { type: 'string', title: 'Display Name', + description: 'Display name for the tool', default: '', }, description: { type: 'string', title: 'Description', + description: 'Description of the tool', default: '', }, error_message: { @@ -3039,30 +3365,37 @@ export const $ToolDefinition = { }, ], title: 'Error Message', + description: 'Error message', default: '', }, kwargs: { type: 'object', - title: 'Kwargs', + title: 'kwargs', + description: 'kwags for the tool', default: {}, }, is_visible: { type: 'boolean', title: 'Is Visible', + description: 'Is the tool visible', default: false, }, is_available: { type: 'boolean', title: 'Is Available', + description: 'Is the tool available', default: false, }, category: { $ref: '#/components/schemas/ToolCategory', + title: 'Category', + description: 'Tool category', default: 'Data loader', }, is_auth_required: { type: 'boolean', title: 'Is Auth Required', + description: 'Is auth required for the tool', default: false, }, auth_url: { @@ -3075,6 +3408,7 @@ export const $ToolDefinition = { }, ], title: 'Auth Url', + description: 'Auth url for the tool', default: '', }, token: { @@ -3087,16 +3421,19 @@ export const $ToolDefinition = { }, ], title: 'Token', + description: 'Token for the tool', default: '', }, should_return_token: { type: 'boolean', title: 'Should Return Token', + description: 'If the tool returns a token', default: false, }, }, type: 'object', title: 'ToolDefinition', + description: 'Tool Definition Schema', } as const; export const $ToolInputType = { @@ -3118,6 +3455,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Name', + description: 'Name of the Agent', }, version: { anyOf: [ @@ -3129,6 +3467,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Version', + description: 'Version of the Agent', }, description: { anyOf: [ @@ -3140,6 +3479,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Description', + description: 'Agent Description', }, preamble: { anyOf: [ @@ -3151,6 +3491,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Preamble', + description: 'The preamble for the Agent', }, temperature: { anyOf: [ @@ -3162,6 +3503,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Temperature', + description: 'The temperature for the Agent', }, tools: { anyOf: [ @@ -3176,6 +3518,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Tools', + description: 'List of tools for the Agent', }, organization_id: { anyOf: [ @@ -3186,7 +3529,8 @@ export const $UpdateAgentRequest = { type: 'null', }, ], - title: 'Organization Id', + title: 'Organization ID', + description: 'Organization ID for the Agent', }, is_private: { anyOf: [ @@ -3198,6 +3542,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Is Private', + description: 'If the Agent is private', }, deployment: { anyOf: [ @@ -3209,6 +3554,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Deployment', + description: 'Deployment for the Agent', }, model: { anyOf: [ @@ -3220,6 +3566,7 @@ export const $UpdateAgentRequest = { }, ], title: 'Model', + description: 'Model for the Agent', }, tools_metadata: { anyOf: [ @@ -3234,10 +3581,12 @@ export const $UpdateAgentRequest = { }, ], title: 'Tools Metadata', + description: 'Tools metadata for the Agent', }, }, type: 'object', title: 'UpdateAgentRequest', + description: 'Schema to update an agent', } as const; export const $UpdateAgentToolMetadataRequest = { @@ -3251,7 +3600,8 @@ export const $UpdateAgentToolMetadataRequest = { type: 'null', }, ], - title: 'Id', + title: 'ID', + description: 'Agent Tool Metadata ID', }, tool_name: { anyOf: [ @@ -3263,6 +3613,7 @@ export const $UpdateAgentToolMetadataRequest = { }, ], title: 'Tool Name', + description: 'Tool Name for the agent tool metadata', }, artifacts: { anyOf: [ @@ -3277,10 +3628,12 @@ export const $UpdateAgentToolMetadataRequest = { }, ], title: 'Artifacts', + description: 'Artifacts for the agent tool metadata', }, }, type: 'object', title: 'UpdateAgentToolMetadataRequest', + description: 'Request to update Agent Tool Metadata', } as const; export const $UpdateConversationRequest = { @@ -3295,6 +3648,7 @@ export const $UpdateConversationRequest = { }, ], title: 'Title', + description: 'Title of the conversation', }, description: { anyOf: [ @@ -3306,10 +3660,12 @@ export const $UpdateConversationRequest = { }, ], title: 'Description', + description: 'Description of the conversation', }, }, type: 'object', title: 'UpdateConversationRequest', + description: 'Request to update a conversation', } as const; export const $UpdateDeploymentEnv = { @@ -3320,11 +3676,13 @@ export const $UpdateDeploymentEnv = { }, type: 'object', title: 'Env Vars', + description: 'Environment Variables for the Deployment', }, }, type: 'object', required: ['env_vars'], title: 'UpdateDeploymentEnv', + description: 'Request to update Deployment Environment Variables', } as const; export const $UpdateOrganization = { @@ -3339,83 +3697,98 @@ export const $UpdateOrganization = { }, ], title: 'Name', + description: 'Name of the organization', }, }, type: 'object', - required: ['name'], title: 'UpdateOrganization', + description: 'Request to update an organization', } as const; export const $UploadAgentFileResponse = { properties: { id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, }, type: 'object', required: ['id', 'created_at', 'updated_at', 'file_name'], title: 'UploadAgentFileResponse', + description: 'Reponse for uploading an agent file', } as const; export const $UploadConversationFileResponse = { properties: { id: { type: 'string', - title: 'Id', - }, - user_id: { - type: 'string', - title: 'User Id', + title: 'ID', + description: 'Unique identifier of the file', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When file was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', - }, - conversation_id: { - type: 'string', - title: 'Conversation Id', + title: 'Updated At Timestamp', + description: 'When file was updated', }, file_name: { type: 'string', title: 'File Name', + description: 'Name of the file', }, file_size: { type: 'integer', minimum: 0, title: 'File Size', + description: 'Size of the file in bytes', default: 0, }, + user_id: { + type: 'string', + title: 'User ID', + description: 'Unique identifier for who created the file', + }, + conversation_id: { + type: 'string', + title: 'Conversation ID', + description: 'Unique identifier for the conversation the file is associated to', + }, }, type: 'object', - required: ['id', 'user_id', 'created_at', 'updated_at', 'conversation_id', 'file_name'], + required: ['id', 'created_at', 'updated_at', 'file_name', 'user_id', 'conversation_id'], title: 'UploadConversationFileResponse', + description: 'Response for uploading a conversation file', } as const; export const $ValidationError = { @@ -3459,7 +3832,8 @@ export const $backend__schemas__scim__CreateUser = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3471,6 +3845,7 @@ export const $backend__schemas__scim__CreateUser = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3478,9 +3853,12 @@ export const $backend__schemas__scim__CreateUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', }, name: { $ref: '#/components/schemas/Name', + title: 'Name', + description: 'Name of user', }, emails: { items: { @@ -3488,14 +3866,16 @@ export const $backend__schemas__scim__CreateUser = { }, type: 'array', title: 'Emails', + description: 'List of emails for user', }, externalId: { type: 'string', - title: 'Externalid', + title: 'External ID', + description: 'External ID for the user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'name', 'emails', 'externalId'], + required: ['schemas', 'name', 'emails', 'externalId'], title: 'CreateUser', } as const; @@ -3510,7 +3890,8 @@ export const $backend__schemas__scim__UpdateUser = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3522,6 +3903,7 @@ export const $backend__schemas__scim__UpdateUser = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3529,6 +3911,11 @@ export const $backend__schemas__scim__UpdateUser = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', + }, + name: { + $ref: '#/components/schemas/Name', + description: 'Name of user', }, emails: { items: { @@ -3536,13 +3923,11 @@ export const $backend__schemas__scim__UpdateUser = { }, type: 'array', title: 'Emails', - }, - name: { - $ref: '#/components/schemas/Name', + description: 'List of emails for user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'emails', 'name'], + required: ['schemas', 'name', 'emails'], title: 'UpdateUser', } as const; @@ -3557,7 +3942,8 @@ export const $backend__schemas__scim__User = { type: 'null', }, ], - title: 'Username', + title: 'User Name', + description: 'User name', }, active: { anyOf: [ @@ -3569,6 +3955,7 @@ export const $backend__schemas__scim__User = { }, ], title: 'Active', + description: 'Is user active', }, schemas: { items: { @@ -3576,21 +3963,25 @@ export const $backend__schemas__scim__User = { }, type: 'array', title: 'Schemas', + description: 'Schemas for the user', }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: 'Unique identifier for the user', }, externalId: { type: 'string', - title: 'Externalid', + title: 'External ID', + description: 'External ID for the user', }, meta: { $ref: '#/components/schemas/Meta', + description: 'Metadata for the user', }, }, type: 'object', - required: ['userName', 'active', 'schemas', 'id', 'externalId', 'meta'], + required: ['schemas', 'id', 'externalId', 'meta'], title: 'User', } as const; @@ -3606,6 +3997,7 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Password', + description: 'Password for the user', }, hashed_password: { anyOf: [ @@ -3618,10 +4010,12 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Hashed Password', + description: "The user's password hashed", }, fullname: { type: 'string', - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3633,11 +4027,13 @@ export const $backend__schemas__user__CreateUser = { }, ], title: 'Email', + description: "User's email address", }, }, type: 'object', required: ['fullname'], title: 'CreateUser', + description: 'Request to create a user', } as const; export const $backend__schemas__user__UpdateUser = { @@ -3652,6 +4048,7 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Password', + description: 'Password for the user', }, hashed_password: { anyOf: [ @@ -3664,6 +4061,7 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Hashed Password', + description: "The user's password hashed", }, fullname: { anyOf: [ @@ -3674,7 +4072,8 @@ export const $backend__schemas__user__UpdateUser = { type: 'null', }, ], - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3686,17 +4085,20 @@ export const $backend__schemas__user__UpdateUser = { }, ], title: 'Email', + description: "User's email address", }, }, type: 'object', title: 'UpdateUser', + description: 'Request to update a user', } as const; export const $backend__schemas__user__User = { properties: { fullname: { type: 'string', - title: 'Fullname', + title: 'Full Name', + description: "User's Full Name", }, email: { anyOf: [ @@ -3708,23 +4110,28 @@ export const $backend__schemas__user__User = { }, ], title: 'Email', + description: "User's email address", }, id: { type: 'string', - title: 'Id', + title: 'ID', + description: '', }, created_at: { type: 'string', format: 'date-time', - title: 'Created At', + title: 'Created At Timestamp', + description: 'When the user was created', }, updated_at: { type: 'string', format: 'date-time', - title: 'Updated At', + title: 'Updated At Timestamp', + description: 'When the user was updated', }, }, type: 'object', required: ['fullname', 'id', 'created_at', 'updated_at'], title: 'User', + description: 'User schema', } as const; diff --git a/src/interfaces/coral_web/src/cohere-client/generated/services.gen.ts b/src/interfaces/coral_web/src/cohere-client/generated/services.gen.ts index 2bdae5d23f..f4037bd662 100644 --- a/src/interfaces/coral_web/src/cohere-client/generated/services.gen.ts +++ b/src/interfaces/coral_web/src/cohere-client/generated/services.gen.ts @@ -2,7 +2,6 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest'; import type { CancelablePromise } from './core/CancelablePromise'; import type { - ApplyMigrationsMigratePostResponse, AuthorizeV1StrategyAuthPostData, AuthorizeV1StrategyAuthPostResponse, BatchUploadFileV1AgentsBatchUploadFilePostData, @@ -61,8 +60,8 @@ import type { GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse, GetAgentByIdV1AgentsAgentIdGetData, GetAgentByIdV1AgentsAgentIdGetResponse, - GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData, - GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetResponse, + GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData, + GetAgentDeploymentV1AgentsAgentIdDeploymentsGetResponse, GetAgentFileV1AgentsAgentIdFilesFileIdGetData, GetAgentFileV1AgentsAgentIdFilesFileIdGetResponse, GetConversationV1ConversationsConversationIdGetData, @@ -146,17 +145,12 @@ import type { UpdateUserV1UsersUserIdPutResponse, } from './types.gen'; -export class DefaultService { +export class AuthService { constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Strategies * Retrieves the currently enabled list of Authentication strategies. - * - * Args: - * ctx (Context): Context object. - * Returns: - * List[dict]: List of dictionaries containing the enabled auth strategy names. * @returns ListAuthStrategy Successful Response * @throws ApiError */ @@ -172,14 +166,6 @@ export class DefaultService { * Logs user in, performing basic email/password auth. * Verifies their credentials, retrieves the user and returns a JWT token. * - * Args: - * login (Login): Login payload. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * dict: JWT token on Basic auth success - * * Raises: * HTTPException: If the strategy or payload are invalid, or if the login fails. * @param data The data for the request. @@ -203,21 +189,11 @@ export class DefaultService { * Authorize * Callback authorization endpoint used for OAuth providers after authenticating on the provider's login screen. * - * Args: - * strategy (str): Current strategy name. - * request (Request): Current Request object. - * session (Session): DB session. - * code (str): OAuth code. - * ctx (Context): Context object. - * - * Returns: - * dict: Containing "token" key, on success. - * * Raises: * HTTPException: If authentication fails, or strategy is invalid. * @param data The data for the request. - * @param data.strategy - * @param data.code + * @param data.strategy Name of strategy in question + * @param data.code OAuth Code * @returns JWTResponse Successful Response * @throws ApiError */ @@ -242,15 +218,6 @@ export class DefaultService { /** * Logout * Logs out the current user, adding the given JWT token to the blacklist. - * - * Args: - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * token (dict): JWT token payload. - * ctx (Context): Context object. - * - * Returns: - * dict: Empty on success * @returns Logout Successful Response * @throws ApiError */ @@ -269,11 +236,6 @@ export class DefaultService { * * If completed, a ToolAuth is stored in the DB containing the access token for the tool. * - * Args: - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * * Returns: * RedirectResponse: A redirect pointing to the frontend, contains an error query parameter if * an unexpected error happens during the authentication. @@ -296,19 +258,10 @@ export class DefaultService { * * If completed, the corresponding ToolAuth for the requesting user is removed from the DB. * - * Args: - * tool_id (str): Tool ID to be deleted for the user. (eg. google_drive) Should be one of the values listed in the Tool string enum class. - * request (Request): current Request object. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteToolAuth: Empty response. - * * Raises: * HTTPException: If there was an error deleting the tool auth. * @param data The data for the request. - * @param data.toolId + * @param data.toolId Tool ID for tool in question * @returns DeleteToolAuth Successful Response * @throws ApiError */ @@ -326,19 +279,14 @@ export class DefaultService { }, }); } +} + +export class ChatService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Chat Stream * Stream chat endpoint to handle user messages and return chatbot responses. - * - * Args: - * session (DBSessionDep): Database session. - * chat_request (CohereChatRequest): Chat request data. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * EventSourceResponse: Server-sent event response with chatbot responses. * @param data The data for the request. * @param data.requestBody * @returns ChatResponseEvent Successful Response @@ -361,15 +309,6 @@ export class DefaultService { /** * Regenerate Chat Stream * Endpoint to regenerate stream chat response for the last user message. - * - * Args: - * session (DBSessionDep): Database session. - * chat_request (CohereChatRequest): Chat request data. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * EventSourceResponse: Server-sent event response with chatbot responses. * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -392,15 +331,6 @@ export class DefaultService { /** * Chat * Chat endpoint to handle user messages and return chatbot responses. - * - * Args: - * chat_request (CohereChatRequest): Chat request data. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * NonStreamedChatResponse: Chatbot response. * @param data The data for the request. * @param data.requestBody * @returns NonStreamedChatResponse Successful Response @@ -417,18 +347,14 @@ export class DefaultService { }, }); } +} + +export class UserService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create User * Create a new user. - * - * Args: - * user (CreateUser): User data to be created. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * User: Created user. * @param data The data for the request. * @param data.requestBody * @returns backend__schemas__user__User Successful Response @@ -451,18 +377,9 @@ export class DefaultService { /** * List Users * List all users. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of users to be listed. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[User]: List of users. * @param data The data for the request. - * @param data.offset - * @param data.limit + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -486,18 +403,10 @@ export class DefaultService { * Get User * Get a user by ID. * - * Args: - * user_id (str): User ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * User: User with the given ID. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -520,20 +429,10 @@ export class DefaultService { * Update User * Update a user by ID. * - * Args: - * user_id (str): User ID. - * new_user (UpdateUser): New user data. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object - * - * Returns: - * User: Updated user. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns backend__schemas__user__User Successful Response * @throws ApiError @@ -557,21 +456,12 @@ export class DefaultService { /** * Delete User - * " * Delete a user by ID. * - * Args: - * user_id (str): User ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteUser: Empty response. - * * Raises: * HTTPException: If the user with the given ID is not found. * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns DeleteUser Successful Response * @throws ApiError */ @@ -589,23 +479,19 @@ export class DefaultService { }, }); } +} + +export class ConversationService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Conversation * Get a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * ConversationPublic: Conversation with the given ID. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns ConversationPublic Successful Response * @throws ApiError */ @@ -628,19 +514,10 @@ export class DefaultService { * Update Conversation * Update a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * new_conversation (UpdateConversationRequest): New conversation data. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * ConversationPublic: Updated conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @param data.requestBody * @returns ConversationPublic Successful Response * @throws ApiError @@ -666,18 +543,10 @@ export class DefaultService { * Delete Conversation * Delete a conversation by ID. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteConversationResponse: Empty response. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns DeleteConversationResponse Successful Response * @throws ApiError */ @@ -699,22 +568,11 @@ export class DefaultService { /** * List Conversations * List all conversations. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of conversations to be listed. - * order_by (str): A field by which to order the conversations. - * agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * list[ConversationWithoutMessages]: List of conversations. * @param data The data for the request. - * @param data.offset - * @param data.limit - * @param data.orderBy - * @param data.agentId + * @param data.orderBy Field to sorts results by + * @param data.agentId Agent ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns ConversationWithoutMessages Successful Response * @throws ApiError */ @@ -725,10 +583,10 @@ export class DefaultService { method: 'GET', url: '/v1/conversations', query: { - offset: data.offset, - limit: data.limit, order_by: data.orderBy, agent_id: data.agentId, + offset: data.offset, + limit: data.limit, }, errors: { 422: 'Validation Error', @@ -738,8 +596,9 @@ export class DefaultService { /** * Toggle Conversation Pin + * Toggle whether a conversation is pinned or not * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @param data.requestBody * @returns ConversationWithoutMessages Successful Response * @throws ApiError @@ -764,23 +623,12 @@ export class DefaultService { /** * Search Conversations * Search conversations by title. - * - * Args: - * query (str): Query string to search for in conversation titles. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * offset (int): Offset to start the list. - * limit (int): Limit of conversations to be listed. - * agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. - * ctx (Context): Context object. - * - * Returns: - * list[ConversationWithoutMessages]: List of conversations that match the query. * @param data The data for the request. - * @param data.query - * @param data.offset - * @param data.limit - * @param data.agentId + * @param data.query Query string to search for in a conversation title + * @param data.orderBy Field to sorts results by + * @param data.agentId Agent ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns ConversationWithoutMessages Successful Response * @throws ApiError */ @@ -792,9 +640,10 @@ export class DefaultService { url: '/v1/conversations:search', query: { query: data.query, + order_by: data.orderBy, + agent_id: data.agentId, offset: data.offset, limit: data.limit, - agent_id: data.agentId, }, errors: { 422: 'Validation Error', @@ -807,15 +656,6 @@ export class DefaultService { * Uploads and creates a batch of File object. * If no conversation_id is provided, a new Conversation is created as well. * - * Args: - * session (DBSessionDep): Database session. - * conversation_id (Optional[str]): Conversation ID passed from request query parameter. - * files (list[FastAPIUploadFile]): List of files to be uploaded. - * ctx (Context): Context object. - * - * Returns: - * list[UploadConversationFileResponse]: List of uploaded files. - * * Raises: * HTTPException: If the conversation with the given ID is not found. Status code 404. * HTTPException: If the file wasn't uploaded correctly. Status code 500. @@ -842,18 +682,10 @@ export class DefaultService { * List Files * List all files from a conversation. Important - no pagination support yet. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[ListConversationFile]: List of files from the conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId + * @param data.conversationId Conversation ID for conversation in question * @returns ListConversationFile Successful Response * @throws ApiError */ @@ -876,20 +708,11 @@ export class DefaultService { * Get File * Get a conversation file by ID. * - * Args: - * conversation_id (str): Conversation ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * FileMetadata: File with the given ID. - * * Raises: * HTTPException: If the conversation or file with the given ID is not found, or if the file does not belong to the conversation. * @param data The data for the request. - * @param data.conversationId - * @param data.fileId + * @param data.conversationId Conversation ID for conversation in question + * @param data.fileId File ID for file in question * @returns FileMetadata Successful Response * @throws ApiError */ @@ -913,19 +736,11 @@ export class DefaultService { * Delete File * Delete a file by ID. * - * Args: - * conversation_id (str): Conversation ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteFile: Empty response. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId - * @param data.fileId + * @param data.conversationId Conversation ID for conversation in question + * @param data.fileId File ID for file in question * @returns DeleteConversationFileResponse Successful Response * @throws ApiError */ @@ -949,20 +764,11 @@ export class DefaultService { * Generate Title * Generate a title for a conversation and update the conversation with the generated title. * - * Args: - * conversation_id (str): Conversation ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * ctx (Context): Context object. - * - * Returns: - * str: Generated title for the conversation. - * * Raises: * HTTPException: If the conversation with the given ID is not found. * @param data The data for the request. - * @param data.conversationId - * @param data.model + * @param data.conversationId Conversation ID for conversation in question + * @param data.model Model to filter results by * @returns GenerateTitleResponse Successful Response * @throws ApiError */ @@ -988,20 +794,11 @@ export class DefaultService { * Synthesize Message * Generate a synthesized audio for a specific message in a conversation. * - * Args: - * conversation_id (str): Conversation ID. - * message_id (str): Message ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Response: Synthesized audio file. - * * Raises: * HTTPException: If the message with the given ID is not found or synthesis fails. * @param data The data for the request. - * @param data.conversationId - * @param data.messageId + * @param data.conversationId Conversation ID for conversation in question + * @param data.messageId Message ID for message in question * @returns unknown Successful Response * @throws ApiError */ @@ -1020,20 +817,16 @@ export class DefaultService { }, }); } +} + +export class ToolService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Tools * List all available tools. - * - * Args: - * request (Request): The request to validate - * session (DBSessionDep): Database session. - * agent_id (str): Agent ID. - * ctx (Context): Context object. - * Returns: - * list[ToolDefinition]: List of available tools. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID to filter results by * @returns ToolDefinition Successful Response * @throws ApiError */ @@ -1051,17 +844,14 @@ export class DefaultService { }, }); } +} + +export class DeploymentService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Deployment * Create a new deployment. - * - * Args: - * deployment (DeploymentCreate): Deployment data to be created. - * session (DBSessionDep): Database session. - * - * Returns: - * DeploymentDefinition: Created deployment. * @param data The data for the request. * @param data.requestBody * @returns DeploymentDefinition Successful Response @@ -1084,15 +874,8 @@ export class DefaultService { /** * List Deployments * List all available deployments and their models. - * - * Args: - * session (DBSessionDep) - * all (bool): Include all deployments, regardless of availability. - * ctx (Context): Context object. - * Returns: - * list[Deployment]: List of available deployment options. * @param data The data for the request. - * @param data.all + * @param data.all Include all deployments, regardless of availability. * @returns DeploymentDefinition Successful Response * @throws ApiError */ @@ -1115,18 +898,10 @@ export class DefaultService { * Update Deployment * Update a deployment. * - * Args: - * deployment_id (str): Deployment ID. - * new_deployment (DeploymentUpdate): Deployment data to be updated. - * session (DBSessionDep): Database session. - * - * Returns: - * Deployment: Updated deployment. - * * Raises: * HTTPException: If deployment not found. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @param data.requestBody * @returns DeploymentDefinition Successful Response * @throws ApiError @@ -1151,11 +926,8 @@ export class DefaultService { /** * Get Deployment * Get a deployment by ID. - * - * Returns: - * Deployment: Deployment with the given ID. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @returns DeploymentDefinition Successful Response * @throws ApiError */ @@ -1178,18 +950,10 @@ export class DefaultService { * Delete Deployment * Delete a deployment by ID. * - * Args: - * deployment_id (str): Deployment ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * DeleteDeployment: Empty response. - * * Raises: * HTTPException: If the deployment with the given ID is not found. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @returns DeleteDeployment Successful Response * @throws ApiError */ @@ -1211,18 +975,10 @@ export class DefaultService { /** * Update Config * Set environment variables for the deployment. - * - * Args: - * deployment_id (str): Deployment ID. - * session (DBSessionDep): Database session. - * env_vars (UpdateDeploymentEnv): Environment variables to set. - * valid_env_vars (str): Validated environment variables. - * Returns: - * str: Empty string. * @param data The data for the request. - * @param data.deploymentId + * @param data.deploymentId Deployment ID for deployment in question * @param data.requestBody - * @returns unknown Successful Response + * @returns DeploymentDefinition Successful Response * @throws ApiError */ public updateConfigV1DeploymentsDeploymentIdUpdateConfigPost( @@ -1241,15 +997,14 @@ export class DefaultService { }, }); } +} + +export class ExperimentalFeaturesService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Experimental Features * List all experimental features and if they are enabled - * - * Args: - * ctx (Context): Context object. - * Returns: - * Dict[str, bool]: Experimental feature and their isEnabled state * @returns boolean Successful Response * @throws ApiError */ @@ -1259,17 +1014,15 @@ export class DefaultService { url: '/v1/experimental_features/', }); } +} + +export class AgentService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Agent * Create an agent. * - * Args: - * session (DBSessionDep): Database session. - * agent (CreateAgentRequest): Agent data. - * ctx (Context): Context object. - * Returns: - * AgentPublic: Created agent with no user ID or organization ID. * Raises: * HTTPException: If the agent creation fails. * @param data The data for the request. @@ -1294,20 +1047,11 @@ export class DefaultService { /** * List Agents * List all agents. - * - * Args: - * offset (int): Offset to start the list. - * limit (int): Limit of agents to be listed. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[AgentPublic]: List of agents with no user ID or organization ID. * @param data The data for the request. - * @param data.offset - * @param data.limit - * @param data.visibility - * @param data.organizationId + * @param data.visibility Agent visibility + * @param data.organizationId Organization ID to filter results by + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns AgentPublic Successful Response * @throws ApiError */ @@ -1318,10 +1062,10 @@ export class DefaultService { method: 'GET', url: '/v1/agents', query: { - offset: data.offset, - limit: data.limit, visibility: data.visibility, organization_id: data.organizationId, + offset: data.offset, + limit: data.limit, }, errors: { 422: 'Validation Error', @@ -1331,18 +1075,12 @@ export class DefaultService { /** * Get Agent By Id - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Agent: Agent. + * Return an agent by ID. * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns AgentPublic Successful Response * @throws ApiError */ @@ -1365,19 +1103,10 @@ export class DefaultService { * Update Agent * Update an agent by ID. * - * Args: - * agent_id (str): Agent ID. - * new_agent (UpdateAgentRequest): New agent data. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * AgentPublic: Updated agent with no user ID or organization ID. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @param data.requestBody * @returns AgentPublic Successful Response * @throws ApiError @@ -1403,18 +1132,10 @@ export class DefaultService { * Delete Agent * Delete an agent by ID. * - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteAgent: Empty response. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns DeleteAgent Successful Response * @throws ApiError */ @@ -1434,25 +1155,19 @@ export class DefaultService { } /** - * Get Agent Deployments - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Agent: Agent. + * Get Agent Deployment + * Get the deployment for an agent * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns DeploymentDefinition Successful Response * @throws ApiError */ - public getAgentDeploymentsV1AgentsAgentIdDeploymentsGet( - data: GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData - ): CancelablePromise { + public getAgentDeploymentV1AgentsAgentIdDeploymentsGet( + data: GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData + ): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/v1/agents/{agent_id}/deployments', @@ -1469,18 +1184,10 @@ export class DefaultService { * List Agent Tool Metadata * List all agent tool metadata by agent ID. * - * Args: - * agent_id (str): Agent ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[AgentToolMetadataPublic]: List of agent tool metadata with no user ID or organization ID. - * * Raises: * HTTPException: If the agent tool metadata retrieval fails. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @returns AgentToolMetadataPublic Successful Response * @throws ApiError */ @@ -1503,19 +1210,10 @@ export class DefaultService { * Create Agent Tool Metadata * Create an agent tool metadata. * - * Args: - * session (DBSessionDep): Database session. - * agent_id (str): Agent ID. - * agent_tool_metadata (CreateAgentToolMetadataRequest): Agent tool metadata data. - * ctx (Context): Context object. - * - * Returns: - * AgentToolMetadataPublic: Created agent tool metadata. - * * Raises: * HTTPException: If the agent tool metadata creation fails. * @param data The data for the request. - * @param data.agentId + * @param data.agentId Agent ID for agent in question * @param data.requestBody * @returns AgentToolMetadataPublic Successful Response * @throws ApiError @@ -1541,22 +1239,12 @@ export class DefaultService { * Update Agent Tool Metadata * Update an agent tool metadata by ID. * - * Args: - * agent_id (str): Agent ID. - * agent_tool_metadata_id (str): Agent tool metadata ID. - * session (DBSessionDep): Database session. - * new_agent_tool_metadata (UpdateAgentToolMetadataRequest): New agent tool metadata data. - * ctx (Context): Context object. - * - * Returns: - * AgentToolMetadata: Updated agent tool metadata. - * * Raises: * HTTPException: If the agent tool metadata with the given ID is not found. * HTTPException: If the agent tool metadata update fails. * @param data The data for the request. - * @param data.agentId - * @param data.agentToolMetadataId + * @param data.agentId Agent ID for agent in question + * @param data.agentToolMetadataId Agent Tool Metadata ID for tool metadata in question * @param data.requestBody * @returns AgentToolMetadata Successful Response * @throws ApiError @@ -1583,21 +1271,12 @@ export class DefaultService { * Delete Agent Tool Metadata * Delete an agent tool metadata by ID. * - * Args: - * agent_id (str): Agent ID. - * agent_tool_metadata_id (str): Agent tool metadata ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteAgentToolMetadata: Empty response. - * * Raises: * HTTPException: If the agent tool metadata with the given ID is not found. * HTTPException: If the agent tool metadata deletion fails. * @param data The data for the request. - * @param data.agentId - * @param data.agentToolMetadataId + * @param data.agentId Agent ID for agent in question + * @param data.agentToolMetadataId Agent Tool Metadata ID for tool metadata in question * @returns DeleteAgentToolMetadata Successful Response * @throws ApiError */ @@ -1619,6 +1298,7 @@ export class DefaultService { /** * Batch Upload File + * Upload a batch of files * @param data The data for the request. * @param data.formData * @returns UploadAgentFileResponse Successful Response @@ -1642,20 +1322,11 @@ export class DefaultService { * Get Agent File * Get an agent file by ID. * - * Args: - * agent_id (str): Agent ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * FileMetadata: File with the given ID. - * * Raises: * HTTPException: If the agent or file with the given ID is not found, or if the file does not belong to the agent. * @param data The data for the request. - * @param data.agentId - * @param data.fileId + * @param data.agentId Agent ID for agent in question + * @param data.fileId File ID for file in question * @returns FileMetadata Successful Response * @throws ApiError */ @@ -1679,19 +1350,11 @@ export class DefaultService { * Delete Agent File * Delete an agent file by ID. * - * Args: - * agent_id (str): Agent ID. - * file_id (str): File ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteFile: Empty response. - * * Raises: * HTTPException: If the agent with the given ID is not found. * @param data The data for the request. - * @param data.agentId - * @param data.fileId + * @param data.agentId Agent ID for agent in question + * @param data.fileId File ID for file in question * @returns DeleteAgentFileResponse Successful Response * @throws ApiError */ @@ -1710,17 +1373,14 @@ export class DefaultService { }, }); } +} + +export class SnapshotService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Snapshots * List all snapshots. - * - * Args: - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * list[SnapshotWithLinks]: List of all snapshots with their links. * @returns SnapshotWithLinks Successful Response * @throws ApiError */ @@ -1734,14 +1394,6 @@ export class DefaultService { /** * Create Snapshot * Create a new snapshot and snapshot link to share the conversation. - * - * Args: - * snapshot_request (CreateSnapshotRequest): Snapshot creation request. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * CreateSnapshotResponse: Snapshot creation response. * @param data The data for the request. * @param data.requestBody * @returns CreateSnapshotResponse Successful Response @@ -1764,16 +1416,8 @@ export class DefaultService { /** * Get Snapshot * Get a snapshot by link ID. - * - * Args: - * link_id (str): Snapshot link ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * Snapshot: Snapshot with the given link ID. * @param data The data for the request. - * @param data.linkId + * @param data.linkId Link ID for the snapshot link in question * @returns SnapshotPublic Successful Response * @throws ApiError */ @@ -1795,16 +1439,8 @@ export class DefaultService { /** * Delete Snapshot Link * Delete a snapshot link by ID. - * - * Args: - * link_id (str): Snapshot link ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteSnapshotLinkResponse: Empty response. * @param data The data for the request. - * @param data.linkId + * @param data.linkId Link ID for the snapshot link in question * @returns DeleteSnapshotLinkResponse Successful Response * @throws ApiError */ @@ -1826,16 +1462,8 @@ export class DefaultService { /** * Delete Snapshot * Delete a snapshot by ID. - * - * Args: - * snapshot_id (str): Snapshot ID. - * session (DBSessionDep): Database session. - * ctx (Context): Context object. - * - * Returns: - * DeleteSnapshotResponse: Empty response. * @param data The data for the request. - * @param data.snapshotId + * @param data.snapshotId Snapshot ID for the snapshot in question * @returns DeleteSnapshotResponse Successful Response * @throws ApiError */ @@ -1853,17 +1481,14 @@ export class DefaultService { }, }); } +} + +export class OrganizationService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * List Organizations * List all available organizations. - * - * Args: - * request (Request): Request object. - * session (DBSessionDep): Database session. - * - * Returns: - * list[Organization]: List of available organizations. * @returns Organization Successful Response * @throws ApiError */ @@ -1877,13 +1502,6 @@ export class DefaultService { /** * Create Organization * Create a new organization. - * - * Args: - * organization (CreateOrganization): Organization data - * session (DBSessionDep): Database session. - * - * Returns: - * Organization: Created organization. * @param data The data for the request. * @param data.requestBody * @returns Organization Successful Response @@ -1906,16 +1524,8 @@ export class DefaultService { /** * Update Organization * Update organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * new_organization (ToolUpdate): New organization data. - * session (DBSessionDep): Database session. - * - * Returns: - * Organization: Updated organization. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @param data.requestBody * @returns Organization Successful Response * @throws ApiError @@ -1940,16 +1550,8 @@ export class DefaultService { /** * Get Organization * Get a organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * session (DBSessionDep): Database session. - * ctx: Context. - * - * Returns: - * Organization: Organization with the given ID. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns Organization Successful Response * @throws ApiError */ @@ -1971,15 +1573,8 @@ export class DefaultService { /** * Delete Organization * Delete a organization by ID. - * - * Args: - * organization_id (str): Tool ID. - * session (DBSessionDep): Database session. - * - * Returns: - * DeleteOrganization: Organization deleted. * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns DeleteOrganization Successful Response * @throws ApiError */ @@ -2001,15 +1596,8 @@ export class DefaultService { /** * Get Organization Users * Get organization users by ID. - * - * Args: - * organization_id (str): Organization ID. - * session (DBSessionDep): Database session. - * - * Returns: - * list[User]: List of users in the organization * @param data The data for the request. - * @param data.organizationId + * @param data.organizationId Organization ID for the organization in question * @returns backend__schemas__user__User Successful Response * @throws ApiError */ @@ -2027,17 +1615,14 @@ export class DefaultService { }, }); } +} + +export class ModelService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Create Model * Create a new model. - * - * Args: - * model (ModelCreate): Model data to be created. - * session (DBSessionDep): Database session. - * - * Returns: - * ModelSchema: Created model. * @param data The data for the request. * @param data.requestBody * @returns Model Successful Response @@ -2060,12 +1645,9 @@ export class DefaultService { /** * List Models * List all available models - * - * Returns: - * list[Model]: List of available models. * @param data The data for the request. - * @param data.offset - * @param data.limit + * @param data.offset Offset for where request should start returning records from + * @param data.limit Maximum number of records to return per request * @returns Model Successful Response * @throws ApiError */ @@ -2089,18 +1671,10 @@ export class DefaultService { * Update Model * Update a model by ID. * - * Args: - * model_id (str): Model ID. - * new_model (ModelCreateUpdate): New model data. - * session (DBSessionDep): Database session. - * - * Returns: - * ModelSchema: Updated model. - * * Raises: * HTTPException: If the model with the given ID is not found. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @param data.requestBody * @returns Model Successful Response * @throws ApiError @@ -2125,11 +1699,8 @@ export class DefaultService { /** * Get Model * Get a model by ID. - * - * Returns: - * Model: Model with the given ID. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @returns Model Successful Response * @throws ApiError */ @@ -2152,18 +1723,10 @@ export class DefaultService { * Delete Model * Delete a model by ID. * - * Args: - * model_id (str): Model ID. - * session (DBSessionDep): Database session. - * request (Request): Request object. - * - * Returns: - * DeleteModel: Empty response. - * * Raises: * HTTPException: If the model with the given ID is not found. * @param data The data for the request. - * @param data.modelId + * @param data.modelId Model ID for the model in question * @returns DeleteModel Successful Response * @throws ApiError */ @@ -2181,13 +1744,18 @@ export class DefaultService { }, }); } +} + +export class ScimService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Get Users + * Return users * @param data The data for the request. - * @param data.count - * @param data.startIndex - * @param data.filter + * @param data.startIndex Start Index for request + * @param data.count Maximum number of records to return per request + * @param data.filter Filter to use when filtering response * @returns ListUserResponse Successful Response * @throws ApiError */ @@ -2198,8 +1766,8 @@ export class DefaultService { method: 'GET', url: '/scim/v2/Users', query: { - count: data.count, start_index: data.startIndex, + count: data.count, filter: data.filter, }, errors: { @@ -2210,6 +1778,7 @@ export class DefaultService { /** * Create User + * Create a new user * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -2231,8 +1800,9 @@ export class DefaultService { /** * Get User + * Get user by User ID * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @returns unknown Successful Response * @throws ApiError */ @@ -2253,8 +1823,9 @@ export class DefaultService { /** * Update User + * Update a user * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2278,8 +1849,9 @@ export class DefaultService { /** * Patch User + * Patch a user * @param data The data for the request. - * @param data.userId + * @param data.userId User ID for the user in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2303,10 +1875,11 @@ export class DefaultService { /** * Get Groups + * Return Groups * @param data The data for the request. - * @param data.count - * @param data.startIndex - * @param data.filter + * @param data.startIndex Start Index for request + * @param data.count Maximum number of records to return per request + * @param data.filter Filter to use when filtering response * @returns ListGroupResponse Successful Response * @throws ApiError */ @@ -2317,8 +1890,8 @@ export class DefaultService { method: 'GET', url: '/scim/v2/Groups', query: { - count: data.count, start_index: data.startIndex, + count: data.count, filter: data.filter, }, errors: { @@ -2329,6 +1902,7 @@ export class DefaultService { /** * Create Group + * Create a group * @param data The data for the request. * @param data.requestBody * @returns unknown Successful Response @@ -2350,8 +1924,9 @@ export class DefaultService { /** * Get Group + * Get group by group ID * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @returns unknown Successful Response * @throws ApiError */ @@ -2372,8 +1947,9 @@ export class DefaultService { /** * Patch Group + * Patch a group * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @param data.requestBody * @returns unknown Successful Response * @throws ApiError @@ -2397,8 +1973,9 @@ export class DefaultService { /** * Delete Group + * Delete a group * @param data The data for the request. - * @param data.groupId + * @param data.groupId Group ID for the group in question * @returns void Successful Response * @throws ApiError */ @@ -2416,6 +1993,10 @@ export class DefaultService { }, }); } +} + +export class DefaultService { + constructor(public readonly httpRequest: BaseHttpRequest) {} /** * Health @@ -2429,17 +2010,4 @@ export class DefaultService { url: '/health', }); } - - /** - * Apply Migrations - * Applies Alembic migrations - useful for serverless applications - * @returns unknown Successful Response - * @throws ApiError - */ - public applyMigrationsMigratePost(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/migrate', - }); - } } diff --git a/src/interfaces/coral_web/src/cohere-client/generated/types.gen.ts b/src/interfaces/coral_web/src/cohere-client/generated/types.gen.ts index 19570e37bd..988b666e0f 100644 --- a/src/interfaces/coral_web/src/cohere-client/generated/types.gen.ts +++ b/src/interfaces/coral_web/src/cohere-client/generated/types.gen.ts @@ -1,45 +1,138 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * Public agent schema + */ export type AgentPublic = { + /** + * User ID for the Agent + */ user_id: string; + /** + * Agent ID + */ id: string; + /** + * When the agent was created + */ created_at: string; + /** + * When the agent was updated + */ updated_at: string; - version: number; + /** + * Name of the Agent + */ name: string; - description: string | null; - preamble: string | null; + /** + * Version of the Agent + */ + version: number; + /** + * Agent Description + */ + description?: string | null; + /** + * The preamble for the Agent + */ + preamble?: string | null; + /** + * The temperature for the Agent + */ temperature: number; - tools: Array | null; + /** + * List of tools for the Agent + */ + tools?: Array | null; + /** + * List of tool metadata for the Agent + */ tools_metadata?: Array | null; - deployment: string | null; - model: string | null; - is_private: boolean | null; + /** + * Deployment for the Agent + */ + deployment?: string | null; + /** + * Model for the Agent + */ + model?: string | null; + /** + * If the Agent is private + */ + is_private?: boolean | null; }; +/** + * Agent tool metadata schema + */ export type AgentToolMetadata = { + /** + * Agent tool metadata ID + */ id: string; + /** + * When the agent tool metadata was created + */ created_at: string; + /** + * When the agent tool metadata was updated + */ updated_at: string; - user_id: string | null; + /** + * User ID for the agent tool metadata + */ + user_id?: string | null; + /** + * Agent ID for the agent tool metadata + */ agent_id: string; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; +/** + * Public agent tool metadata schema + */ export type AgentToolMetadataPublic = { + /** + * Agent tool metadata ID + */ id: string; + /** + * When the agent tool metadata was created + */ created_at: string; + /** + * When the agent tool metadata was updated + */ updated_at: string; + /** + * Agent ID for the agent tool metadata + */ agent_id: string; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; +/** + * Supported values for Agent Visibility + */ export enum AgentVisibility { PRIVATE = 'private', PUBLIC = 'public', @@ -56,22 +149,44 @@ export type Body_batch_upload_file_v1_conversations_batch_upload_file_post = { }; /** - * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message. + * A list of previous messages between the user and the model, meant to give the mode + * conversational context for responding to the user's message. */ export type ChatMessage = { role: ChatRole; + /** + * Contents of the chat message. + */ message?: string | null; + /** + * Contents of the tool plan. + */ tool_plan?: string | null; + /** + * Results from the tool call. + */ tool_results?: Array<{ [key: string]: unknown; }> | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array<{ [key: string]: unknown; }> | null; }; +/** + * Chat Response Event + */ export type ChatResponseEvent = { + /** + * Type of stream event + */ event: StreamEvent; + /** + * Data returned from chat response of a given event type + */ data: | StreamStart | StreamTextGeneration @@ -97,10 +212,25 @@ export enum ChatRole { TOOL = 'TOOL', } +/** + * Schema for a citation + */ export type Citation = { + /** + * Citation text + */ text: string; + /** + * Start position for the citation + */ start: number; + /** + * End position for the citation + */ end: number; + /** + * Documents used for the citation + */ document_ids: Array; }; @@ -117,218 +247,703 @@ export enum CohereChatPromptTruncation { * See: https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L1629 */ export type CohereChatRequest = { + /** + * The message to send to the chatbot + */ message: string; + /** + * A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state. + */ chat_history?: Array | null; + /** + * To store a conversation then create a conversation id and use it for every related request + */ conversation_id?: string; + /** + * + * List of custom or managed tools to use for the response. + * If passing in managed tools, you only need to provide the name of the tool. + * If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. + * Passing a mix of custom and managed tools is not supported. + * + * Managed Tools Examples: + * tools=[ + * { + * "name": "Wiki Retriever - LangChain", + * }, + * { + * "name": "Calculator", + * } + * ] + * + * Custom Tools Examples: + * tools=[ + * { + * "name": "movie_title_generator", + * "description": "tool to generate a cool movie title", + * "parameter_definitions": { + * "synopsis": { + * "description": "short synopsis of the movie", + * "type": "str", + * "required": true + * } + * } + * }, + * { + * "name": "random_number_generator", + * "description": "tool to generate a random number between min and max", + * "parameter_definitions": { + * "min": { + * "description": "minimum number", + * "type": "int", + * "required": true + * }, + * "max": { + * "description": "maximum number", + * "type": "int", + * "required": true + * } + * } + * }, + * { + * "name": "joke_generator", + * "description": "tool to generate a random joke", + * } + * ] + * + */ tools?: Array | null; + /** + * Documents to use to generate grounded response with citations. Example: + * documents=[ + * { + * "id": "national_geographic_everest", + * "title": "Height of Mount Everest", + * "text": "The height of Mount Everest is 29,035 feet", + * "url": "https://education.nationalgeographic.org/resource/mount-everest/", + * }, + * { + * "id": "national_geographic_mariana", + * "title": "Depth of the Mariana Trench", + * "text": "The depth of the Mariana Trench is 36,070 feet", + * "url": "https://www.nationalgeographic.org/activity/mariana-trench-deepest-place-earth", + * }, + * ] + * + */ documents?: Array<{ [key: string]: unknown; }>; + /** + * The model to use for generating the response. + */ model?: string | null; + /** + * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. + */ temperature?: number | null; + /** + * Ensures only the top k most likely tokens are considered for generation at each step. + */ k?: number | null; + /** + * Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k. + */ p?: number | null; + /** + * A string to override the preamble. + */ preamble?: string | null; + /** + * List of File IDs for PDFs used in RAG for the response. + */ file_ids?: Array | null; + /** + * When set to true a list of search queries are generated. No search will occur nor replies to the user's message. + */ search_queries_only?: boolean | null; + /** + * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. + */ max_tokens?: number | null; + /** + * If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed. + */ seed?: number | null; + /** + * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + */ stop_sequences?: Array | null; + /** + * Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. + */ presence_penalty?: number | null; + /** + * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. + */ frequency_penalty?: number | null; - prompt_truncation?: CohereChatPromptTruncation; + /** + * Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'. + */ + prompt_truncation?: CohereChatPromptTruncation | null; + /** + * A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations. + */ tool_results?: Array<{ [key: string]: unknown; }> | null; + /** + * If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message. + */ force_single_step?: boolean | null; + /** + * The agent ID to use for the chat. + */ agent_id?: string | null; }; +/** + * Schema for a public conversation file + */ export type ConversationFilePublic = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; +/** + * A public conversation which removes the User ID and Organization ID + */ export type ConversationPublic = { + /** + * Unique identifier for the conversation + */ id: string; + /** + * When the conversation was created + */ created_at: string; + /** + * When the conversation was updated + */ updated_at: string; + /** + * Title of the conversation + */ title: string; + /** + * The conversation messages + */ messages: Array; + /** + * List of files for the conversation + */ files: Array; - description: string | null; - agent_id: string | null; + /** + * Description of the conversation + */ + description?: string | null; + /** + * Unique identifier for the agent used in the conversation + */ + agent_id?: string | null; + /** + * If conversation is pinned + */ is_pinned: boolean; readonly total_file_size: number; }; +/** + * A public conversation without messages attached + */ export type ConversationWithoutMessages = { + /** + * Unique identifier for the conversation + */ id: string; + /** + * When the conversation was created + */ created_at: string; + /** + * When the conversation was updated + */ updated_at: string; + /** + * Title of the conversation + */ title: string; + /** + * List of files for the conversation + */ files: Array; - description: string | null; - agent_id: string | null; + /** + * Description of the conversation + */ + description?: string | null; + /** + * Unique identifier for the agent used in the conversation + */ + agent_id?: string | null; + /** + * If conversation is pinned + */ is_pinned: boolean; readonly total_file_size: number; }; +/** + * Schema to create an agent + */ export type CreateAgentRequest = { + /** + * Name of the Agent + */ name: string; + /** + * Version of the Agent + */ version?: number | null; + /** + * Agent Description + */ description?: string | null; + /** + * The preamble for the Agent + */ preamble?: string | null; + /** + * The temperature for the Agent + */ temperature?: number | null; + /** + * List of tools for the Agent + */ tools?: Array | null; + /** + * Tools metadata for the Agent + */ tools_metadata?: Array | null; + /** + * Deployment for the Agent + */ + deployment: string; + /** + * Deployment config for the Agent + */ deployment_config?: { [key: string]: string; } | null; + /** + * Model for the Agent + */ model: string; - deployment: string; + /** + * Organization ID for the Agent + */ organization_id?: string | null; + /** + * If the Agent is private + */ is_private?: boolean | null; }; +/** + * Request to create Agent Tool Metadata + */ export type CreateAgentToolMetadataRequest = { + /** + * Agent Tool Metadata ID + */ id?: string | null; + /** + * Tool Name for the agent tool metadata + */ tool_name: string; + /** + * Artifacts for the agent tool metadata + */ artifacts: Array<{ [key: string]: unknown; }>; }; export type CreateGroup = { + /** + * Schemas for the group + */ schemas: Array; + /** + * Members of the group + */ members: Array; + /** + * Display name for the group + */ displayName: string; }; +/** + * Request to create an organization + */ export type CreateOrganization = { + /** + * Name of the organization + */ name: string; }; +/** + * Request to create a snapshot + */ export type CreateSnapshotRequest = { + /** + * Unique identifier for the conversation + */ conversation_id: string; }; +/** + * Response for creating a snapshot + */ export type CreateSnapshotResponse = { + /** + * Unique identifier for the snapshot + */ snapshot_id: string; + /** + * Unique identifier for the link + */ link_id: string; + /** + * List of messages + */ messages: Array; }; +/** + * Response for deleting an agent + */ export type DeleteAgent = unknown; +/** + * Response for deleting an agent file + */ export type DeleteAgentFileResponse = unknown; +/** + * Delete agent tool metadata response + */ export type DeleteAgentToolMetadata = unknown; +/** + * Response for deleting a conversation file + */ export type DeleteConversationFileResponse = unknown; +/** + * Response for deleting a conversation + */ export type DeleteConversationResponse = unknown; +/** + * Delete Deployment Response + */ export type DeleteDeployment = unknown; +/** + * Response for deleting a model + */ export type DeleteModel = unknown; +/** + * Response when deleting organization + */ export type DeleteOrganization = unknown; +/** + * Response for deleting a snapshot link + */ export type DeleteSnapshotLinkResponse = unknown; +/** + * Response for deleting a snapshot + */ export type DeleteSnapshotResponse = unknown; +/** + * Response when deleting a tool auth + */ export type DeleteToolAuth = unknown; +/** + * Response when deleting a user + */ export type DeleteUser = unknown; +/** + * Deployment Create Schema + */ export type DeploymentCreate = { + /** + * Unique Identifier for the Deployment + */ id?: string | null; + /** + * Name of the Deployment + */ name: string; + /** + * Description of the deployment + */ description?: string | null; + /** + * Deployment Class Name + */ deployment_class_name: string; + /** + * Is the deployment from the commmunity + */ is_community?: boolean; + /** + * The default deployment configuration + */ default_deployment_config: { [key: string]: string; }; }; +/** + * Deployment Definition + */ export type DeploymentDefinition = { + /** + * Unique Identifier for the Deployment + */ id: string; + /** + * Name of the Deployment + */ name: string; + /** + * Description of the deployment + */ description?: string | null; + /** + * Config for the deployment + */ config?: { [key: string]: string; }; + /** + * Is deployment is available + */ is_available?: boolean; - is_community?: boolean; + /** + * Is the deployment from the commmunity + */ + is_community?: boolean | null; + /** + * List of models for the deployment + */ models: Array; + /** + * Deployment class name + */ class_name: string; }; +/** + * Deployment Update Schema + */ export type DeploymentUpdate = { + /** + * Name of the Deployment + */ name?: string | null; + /** + * Description of the deployment + */ description?: string | null; + /** + * Deployment Class Name + */ deployment_class_name?: string | null; + /** + * Is the deployment from the commmunity + */ is_community?: boolean | null; + /** + * The default deployment configuration + */ default_deployment_config?: { [key: string]: string; } | null; }; +/** + * Schema for a Document + */ export type Document = { + /** + * Document text + */ text: string; + /** + * Unique Identifier for the document + */ document_id: string; - title: string | null; - url: string | null; - fields: { + /** + * Document title + */ + title?: string | null; + /** + * Document URL + */ + url?: string | null; + /** + * Document Fields + */ + fields?: { [key: string]: unknown; } | null; - tool_name: string | null; + /** + * Tool name for the document + */ + tool_name?: string | null; }; export type Email = { + /** + * Is email the primary email + */ primary: boolean; + /** + * Email value + */ value?: string | null; + /** + * Type of email + */ type: string; }; +/** + * Schema for file metadata + */ export type FileMetadata = { + /** + * Unique identifier of the file + */ id: string; - file_name: string; - file_content: string; - file_size?: number; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; + /** + * Name of the file + */ + file_name: string; + /** + * Size of the file in bytes + */ + file_size?: number; + /** + * The contents of the file + */ + file_content: string; }; +/** + * Response for generating a title + */ export type GenerateTitleResponse = { + /** + * Title generated for the conversation + */ title: string; + /** + * Error message if the response is an error + */ error?: string | null; }; export type Group = { + /** + * Schemas for the group + */ schemas: Array; + /** + * Members of the group + */ members: Array; + /** + * Display name for the group + */ displayName: string; + /** + * Unique identifier for the group + */ id: string; + /** + * Metadata for the group + */ meta: Meta; }; export type GroupMember = { + /** + * Value + */ value: string; + /** + * Display + */ display: string; }; export type GroupOperation = { + /** + * Op + */ op: string; + /** + * Path + */ path?: string | null; + /** + * Value + */ value: | { [key: string]: string; @@ -342,63 +957,186 @@ export type HTTPValidationError = { detail?: Array; }; +/** + * JWT Response + */ export type JWTResponse = { + /** + * JSON Web Token + */ token: string; }; +/** + * List Auth Strategy + */ export type ListAuthStrategy = { + /** + * Auth strategy name + */ strategy: string; - client_id: string | null; - authorization_endpoint: string | null; + /** + * Client ID to be used + */ + client_id?: string | null; + /** + * The endpoint for authorization + */ + authorization_endpoint?: string | null; + /** + * If PKCE is enabled + */ pkce_enabled: boolean; }; +/** + * Listing conversation files + */ export type ListConversationFile = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; export type ListGroupResponse = { + /** + * Total results available + */ totalResults: number; + /** + * Start index for returned results + */ startIndex: number; + /** + * Total results returned in the request + */ itemsPerPage: number; + /** + * List of Groups + */ Resources: Array; }; export type ListUserResponse = { + /** + * Total results available + */ totalResults: number; + /** + * Start index for returned results + */ startIndex: number; + /** + * Total results returned in the request + */ itemsPerPage: number; + /** + * List of Users + */ Resources: Array; }; +/** + * Login Request + */ export type Login = { + /** + * Auth strategy to use + */ strategy: string; + /** + * Login payload depending on strategy used + */ payload?: { [key: string]: string; } | null; }; +/** + * Logout Request + */ export type Logout = unknown; +/** + * Message Schema + */ export type Message = { + /** + * The text content of the message + */ text: string; + /** + * Unique identifier of the message + */ id: string; + /** + * When message was created + */ created_at: string; + /** + * When message was updated + */ updated_at: string; - generation_id: string | null; + /** + * Generation ID for the message + */ + generation_id?: string | null; + /** + * Position in the conversation + */ position: number; + /** + * Is the message active + */ is_active: boolean; + /** + * Documents associated with the message + */ documents: Array; + /** + * Citations associated with the message + */ citations: Array; + /** + * Files associated with the message + */ files: Array; + /** + * Tool calls associated with the message + */ tool_calls: Array; - tool_plan: string | null; + /** + * Tool plan associated with the message + */ + tool_plan?: string | null; + /** + * Agent associated with the message + */ agent: MessageAgent; }; @@ -407,134 +1145,380 @@ export enum MessageAgent { CHATBOT = 'CHATBOT', } +/** + * Schema for metadata + */ export type Meta = { + /** + * Type of resource the metadata is for + */ resourceType: string; + /** + * When metadata was created + */ created: string; + /** + * When metadata was last modified + */ lastModified: string; }; export type Model = { - id: string; + /** + * Model name + */ name: string; + /** + * Cohere model name + */ + cohere_name?: string | null; + /** + * Model description + */ + description?: string | null; + /** + * Unique identifier for the model + */ + id: string; + /** + * Unique identifier for the deployment + */ deployment_id: string; - cohere_name: string | null; - description: string | null; }; export type ModelCreate = { + /** + * Model name + */ name: string; - cohere_name: string | null; - description: string | null; + /** + * Cohere model name + */ + cohere_name?: string | null; + /** + * Model description + */ + description?: string | null; + /** + * Unique identifier for the deployment + */ deployment_id: string; }; export type ModelUpdate = { + /** + * Model name + */ name?: string | null; + /** + * Cohere model name + */ cohere_name?: string | null; + /** + * Model description + */ description?: string | null; + /** + * Unique identifier for the deployment + */ deployment_id?: string | null; }; export type Name = { + /** + * User's given name + */ givenName: string; + /** + * User's family name + */ familyName: string; }; +/** + * Non streamed chat response + */ export type NonStreamedChatResponse = { - response_id: string | null; - generation_id: string | null; - chat_history: Array | null; + /** + * Unique identifier for the response + */ + response_id?: string | null; + /** + * Unique identifier for the generation + */ + generation_id?: string | null; + /** + * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message. + */ + chat_history?: Array | null; + /** + * Reason the chat stream ended + */ finish_reason: string; + /** + * Contents of the chat message + */ text: string; + /** + * Citations for the chat message + */ citations?: Array | null; + /** + * Documents used to generate grounded response with citations + */ documents?: Array | null; + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }> | null; + /** + * List of generated search queries. + */ search_queries?: Array | null; - conversation_id: string | null; + /** + * To store a conversation then create a conversation id and use it for every related request + */ + conversation_id?: string | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array | null; + /** + * Error message if the response is an error + */ error?: string | null; }; export type Operation = { + /** + * Op + */ op: string; + /** + * Value + */ value: { [key: string]: boolean; }; }; +/** + * Schema for an organization + */ export type Organization = { + /** + * Name of the organization + */ name: string; + /** + * Unique identifier of the organization + */ id: string; + /** + * When organization was created + */ created_at: string; + /** + * When organization was updated + */ updated_at: string; }; export type PatchGroup = { + /** + * Schemas for group + */ schemas: Array; + /** + * Operations for the group + */ operations: Array; }; export type PatchUser = { + /** + * Schemas for user + */ schemas: Array; + /** + * Operations for the user + */ operations: Array; }; +/** + * Schema for search query + */ export type SearchQuery = { + /** + * Text for the search + */ text: string; + /** + * Unique identifier for the generation + */ generation_id: string; }; +/** + * Snapshot data + */ export type SnapshotData = { + /** + * Title of the snapshot + */ title: string; + /** + * Description of the snapshot + */ description: string; + /** + * List of messages + */ messages: Array; }; +/** + * Public snapshot + */ export type SnapshotPublic = { + /** + * Unique identifier for the conversation + */ conversation_id: string; + /** + * Unique identifier for the snapshot + */ id: string; + /** + * Unique identifier for the last message + */ last_message_id: string; + /** + * Snapshot version + */ version: number; + /** + * When snapshot was creted + */ created_at: string; + /** + * When snapshot was updated + */ updated_at: string; + /** + * Data for the snapshot + */ snapshot: SnapshotData; }; +/** + * Snapshot with links + */ export type SnapshotWithLinks = { + /** + * Unique identifier for the conversation + */ conversation_id: string; + /** + * Unique identifier for the snapshot + */ id: string; + /** + * Unique identifier for the last message + */ last_message_id: string; + /** + * Snapshot version + */ version: number; + /** + * When snapshot was creted + */ created_at: string; + /** + * When snapshot was updated + */ updated_at: string; + /** + * Data for the snapshot + */ snapshot: SnapshotData; + /** + * List of links + */ links: Array; }; /** - * Stream citation generation event. + * Stream citation generation event */ export type StreamCitationGeneration = { + /** + * Citations for the chat message + */ citations?: Array; }; +/** + * Stream end generation event + */ export type StreamEnd = { + /** + * Unique identifier for the message + */ message_id?: string | null; + /** + * Unique identifier for the response + */ response_id?: string | null; + /** + * Unique identifier for the generation + */ generation_id?: string | null; + /** + * Unique identifier for the conversation + */ conversation_id?: string | null; + /** + * Contents of the chat message + */ text: string; + /** + * Citations for the chat messae. + */ citations?: Array; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }>; + /** + * List of generated search queries + */ search_queries?: Array; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array; + /** + * Reson why the model finished the request + */ finish_reason?: string | null; + /** + * A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state. + */ chat_history?: Array | null; + /** + * Error message if the response is an error + */ error?: string | null; }; @@ -556,92 +1540,200 @@ export enum StreamEvent { } /** - * Stream query generation event. + * Stream query generation event */ export type StreamQueryGeneration = { + /** + * Search query used to generate grounded response with citations + */ query: string; }; /** - * Stream queries generation event. + * Stream queries generation event */ export type StreamSearchQueriesGeneration = { + /** + * Search query used to generate grounded response with citations + */ search_queries?: Array; }; +/** + * Stream search generation event + */ export type StreamSearchResults = { + /** + * Search results used to generate grounded response with citations + */ search_results?: Array<{ [key: string]: unknown; }>; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; }; /** - * Stream start event. + * Stream start event */ export type StreamStart = { + /** + * Generation ID for the event + */ generation_id?: string | null; + /** + * Conversation ID for the event + */ conversation_id?: string | null; }; /** - * Stream text generation event. + * Stream text generation event */ export type StreamTextGeneration = { + /** + * Contents of the chat message + */ text: string; }; +/** + * Stream tool call chunk generated event + */ export type StreamToolCallsChunk = { + /** + * Partial tool call + */ tool_call_delta?: ToolCallDelta | null; - text: string | null; + /** + * Contents of the chat message + */ + text?: string | null; }; /** - * Stream tool calls generation event. + * Stream tool calls generation event */ export type StreamToolCallsGeneration = { + /** + * Search results used to generate grounded response with citations + */ stream_search_results?: StreamSearchResults | null; + /** + * List of tool calls generated for custom tools + */ tool_calls?: Array | null; - text: string | null; + /** + * Contents of the chat message + */ + text?: string | null; }; +/** + * Stream tool input generation event + */ export type StreamToolInput = { + /** + * Tool input type + */ input_type: ToolInputType; + /** + * Name of the tool to be used + */ tool_name: string; + /** + * Tool input + */ input: string; + /** + * Contents of the chat message + */ text: string; }; +/** + * Stream tool result generation event + */ export type StreamToolResult = { + /** + * Result from the tool + */ result: unknown; + /** + * Name of tool that generated the result + */ tool_name: string; + /** + * Documents used to generate grounded response with citations + */ documents?: Array; }; +/** + * Request to toggle pinning a conversation + */ export type ToggleConversationPinRequest = { + /** + * If conversation is pinned + */ is_pinned: boolean; }; +/** + * Tool Schema + */ export type Tool = { + /** + * Name of the Tool + */ name?: string | null; + /** + * Parameters definitions for the tool + */ parameter_definitions?: { [key: string]: unknown; } | null; }; +/** + * Schema for Tool Call + */ export type ToolCall = { + /** + * Name of the Tool + */ name: string; + /** + * Parameters for the tool call + */ parameters?: { [key: string]: unknown; }; }; +/** + * Schema for Tool Call Delta + */ export type ToolCallDelta = { - name: string | null; - index: number | null; - parameters: string | null; + /** + * Name of the Tool + */ + name?: string | null; + /** + * Index + */ + index?: number | null; + /** + * Parameters for the tool call + */ + parameters?: string | null; }; +/** + * Supported Tool Categories + */ export enum ToolCategory { DATA_LOADER = 'Data loader', FILE_LOADER = 'File loader', @@ -649,23 +1741,65 @@ export enum ToolCategory { WEB_SEARCH = 'Web search', } +/** + * Tool Definition Schema + */ export type ToolDefinition = { + /** + * Name of the Tool + */ name?: string | null; + /** + * Parameters definitions for the tool + */ parameter_definitions?: { [key: string]: unknown; } | null; + /** + * Display name for the tool + */ display_name?: string; + /** + * Description of the tool + */ description?: string; + /** + * Error message + */ error_message?: string | null; + /** + * kwags for the tool + */ kwargs?: { [key: string]: unknown; }; + /** + * Is the tool visible + */ is_visible?: boolean; + /** + * Is the tool available + */ is_available?: boolean; + /** + * Tool category + */ category?: ToolCategory; + /** + * Is auth required for the tool + */ is_auth_required?: boolean; + /** + * Auth url for the tool + */ auth_url?: string | null; + /** + * Token for the tool + */ token?: string | null; + /** + * If the tool returns a token + */ should_return_token?: boolean; }; @@ -677,59 +1811,170 @@ export enum ToolInputType { CODE = 'CODE', } +/** + * Schema to update an agent + */ export type UpdateAgentRequest = { + /** + * Name of the Agent + */ name?: string | null; + /** + * Version of the Agent + */ version?: number | null; + /** + * Agent Description + */ description?: string | null; + /** + * The preamble for the Agent + */ preamble?: string | null; + /** + * The temperature for the Agent + */ temperature?: number | null; + /** + * List of tools for the Agent + */ tools?: Array | null; + /** + * Organization ID for the Agent + */ organization_id?: string | null; + /** + * If the Agent is private + */ is_private?: boolean | null; + /** + * Deployment for the Agent + */ deployment?: string | null; + /** + * Model for the Agent + */ model?: string | null; + /** + * Tools metadata for the Agent + */ tools_metadata?: Array | null; }; +/** + * Request to update Agent Tool Metadata + */ export type UpdateAgentToolMetadataRequest = { + /** + * Agent Tool Metadata ID + */ id?: string | null; + /** + * Tool Name for the agent tool metadata + */ tool_name?: string | null; + /** + * Artifacts for the agent tool metadata + */ artifacts?: Array<{ [key: string]: unknown; }> | null; }; +/** + * Request to update a conversation + */ export type UpdateConversationRequest = { + /** + * Title of the conversation + */ title?: string | null; + /** + * Description of the conversation + */ description?: string | null; }; +/** + * Request to update Deployment Environment Variables + */ export type UpdateDeploymentEnv = { + /** + * Environment Variables for the Deployment + */ env_vars: { [key: string]: string; }; }; +/** + * Request to update an organization + */ export type UpdateOrganization = { - name: string | null; + /** + * Name of the organization + */ + name?: string | null; }; +/** + * Reponse for uploading an agent file + */ export type UploadAgentFileResponse = { + /** + * Unique identifier of the file + */ id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; }; +/** + * Response for uploading a conversation file + */ export type UploadConversationFileResponse = { + /** + * Unique identifier of the file + */ id: string; - user_id: string; + /** + * When file was created + */ created_at: string; + /** + * When file was updated + */ updated_at: string; - conversation_id: string; + /** + * Name of the file + */ file_name: string; + /** + * Size of the file in bytes + */ file_size?: number; + /** + * Unique identifier for who created the file + */ + user_id: string; + /** + * Unique identifier for the conversation the file is associated to + */ + conversation_id: string; }; export type ValidationError = { @@ -739,50 +1984,146 @@ export type ValidationError = { }; export type backend__schemas__scim__CreateUser = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; + /** + * Name of user + */ name: Name; + /** + * List of emails for user + */ emails: Array; + /** + * External ID for the user + */ externalId: string; }; export type backend__schemas__scim__UpdateUser = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; - emails: Array; + /** + * Name of user + */ name: Name; + /** + * List of emails for user + */ + emails: Array; }; export type backend__schemas__scim__User = { - userName: string | null; - active: boolean | null; + /** + * User name + */ + userName?: string | null; + /** + * Is user active + */ + active?: boolean | null; + /** + * Schemas for the user + */ schemas: Array; + /** + * Unique identifier for the user + */ id: string; + /** + * External ID for the user + */ externalId: string; + /** + * Metadata for the user + */ meta: Meta; }; +/** + * Request to create a user + */ export type backend__schemas__user__CreateUser = { + /** + * Password for the user + */ password?: string | null; + /** + * The user's password hashed + */ hashed_password?: (Blob | File) | null; + /** + * User's Full Name + */ fullname: string; + /** + * User's email address + */ email?: string | null; }; +/** + * Request to update a user + */ export type backend__schemas__user__UpdateUser = { + /** + * Password for the user + */ password?: string | null; + /** + * The user's password hashed + */ hashed_password?: (Blob | File) | null; + /** + * User's Full Name + */ fullname?: string | null; + /** + * User's email address + */ email?: string | null; }; +/** + * User schema + */ export type backend__schemas__user__User = { + /** + * User's Full Name + */ fullname: string; + /** + * User's email address + */ email?: string | null; id: string; + /** + * When the user was created + */ created_at: string; + /** + * When the user was updated + */ updated_at: string; }; @@ -795,7 +2136,13 @@ export type LoginV1LoginPostData = { export type LoginV1LoginPostResponse = JWTResponse | null; export type AuthorizeV1StrategyAuthPostData = { - code?: string; + /** + * OAuth Code + */ + code?: string | null; + /** + * Name of strategy in question + */ strategy: string; }; @@ -806,6 +2153,9 @@ export type LogoutV1LogoutGetResponse = Logout; export type ToolAuthV1ToolAuthGetResponse = unknown; export type DeleteToolAuthV1ToolAuthToolIdDeleteData = { + /** + * Tool ID for tool in question + */ toolId: string; }; @@ -836,13 +2186,22 @@ export type CreateUserV1UsersPostData = { export type CreateUserV1UsersPostResponse = backend__schemas__user__User; export type ListUsersV1UsersGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; }; export type ListUsersV1UsersGetResponse = Array; export type GetUserV1UsersUserIdGetData = { + /** + * User ID for the user in question + */ userId: string; }; @@ -850,24 +2209,36 @@ export type GetUserV1UsersUserIdGetResponse = backend__schemas__user__User; export type UpdateUserV1UsersUserIdPutData = { requestBody: backend__schemas__user__UpdateUser; + /** + * User ID for the user in question + */ userId: string; }; export type UpdateUserV1UsersUserIdPutResponse = backend__schemas__user__User; export type DeleteUserV1UsersUserIdDeleteData = { + /** + * User ID for the user in question + */ userId: string; }; export type DeleteUserV1UsersUserIdDeleteResponse = DeleteUser; export type GetConversationV1ConversationsConversationIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; export type GetConversationV1ConversationsConversationIdGetResponse = ConversationPublic; export type UpdateConversationV1ConversationsConversationIdPutData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; requestBody: UpdateConversationRequest; }; @@ -875,6 +2246,9 @@ export type UpdateConversationV1ConversationsConversationIdPutData = { export type UpdateConversationV1ConversationsConversationIdPutResponse = ConversationPublic; export type DeleteConversationV1ConversationsConversationIdDeleteData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; @@ -882,15 +2256,30 @@ export type DeleteConversationV1ConversationsConversationIdDeleteResponse = DeleteConversationResponse; export type ListConversationsV1ConversationsGetData = { - agentId?: string; + /** + * Agent ID to filter results by + */ + agentId?: string | null; + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; - orderBy?: string; + /** + * Field to sorts results by + */ + orderBy?: string | null; }; export type ListConversationsV1ConversationsGetResponse = Array; export type ToggleConversationPinV1ConversationsConversationIdTogglePinPutData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; requestBody: ToggleConversationPinRequest; }; @@ -899,9 +2288,25 @@ export type ToggleConversationPinV1ConversationsConversationIdTogglePinPutRespon ConversationWithoutMessages; export type SearchConversationsV1ConversationsSearchGetData = { - agentId?: string; + /** + * Agent ID to filter results by + */ + agentId?: string | null; + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; + /** + * Field to sorts results by + */ + orderBy?: string | null; + /** + * Query string to search for in a conversation title + */ query: string; }; @@ -916,20 +2321,35 @@ export type BatchUploadFileV1ConversationsBatchUploadFilePostResponse = Array; export type ListFilesV1ConversationsConversationIdFilesGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; }; export type ListFilesV1ConversationsConversationIdFilesGetResponse = Array; export type GetFileV1ConversationsConversationIdFilesFileIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * File ID for file in question + */ fileId: string; }; export type GetFileV1ConversationsConversationIdFilesFileIdGetResponse = FileMetadata; export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * File ID for file in question + */ fileId: string; }; @@ -937,7 +2357,13 @@ export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteResponse = DeleteConversationFileResponse; export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * Model to filter results by + */ model?: string | null; }; @@ -945,13 +2371,22 @@ export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse GenerateTitleResponse; export type SynthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGetData = { + /** + * Conversation ID for conversation in question + */ conversationId: string; + /** + * Message ID for message in question + */ messageId: string; }; export type SynthesizeMessageV1ConversationsConversationIdSynthesizeMessageIdGetResponse = unknown; export type ListToolsV1ToolsGetData = { + /** + * Agent ID to filter results by + */ agentId?: string | null; }; @@ -964,12 +2399,18 @@ export type CreateDeploymentV1DeploymentsPostData = { export type CreateDeploymentV1DeploymentsPostResponse = DeploymentDefinition; export type ListDeploymentsV1DeploymentsGetData = { - all?: boolean; + /** + * Include all deployments, regardless of availability. + */ + all?: boolean | null; }; export type ListDeploymentsV1DeploymentsGetResponse = Array; export type UpdateDeploymentV1DeploymentsDeploymentIdPutData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; requestBody: DeploymentUpdate; }; @@ -977,23 +2418,32 @@ export type UpdateDeploymentV1DeploymentsDeploymentIdPutData = { export type UpdateDeploymentV1DeploymentsDeploymentIdPutResponse = DeploymentDefinition; export type GetDeploymentV1DeploymentsDeploymentIdGetData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; }; export type GetDeploymentV1DeploymentsDeploymentIdGetResponse = DeploymentDefinition; export type DeleteDeploymentV1DeploymentsDeploymentIdDeleteData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; }; export type DeleteDeploymentV1DeploymentsDeploymentIdDeleteResponse = DeleteDeployment; export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostData = { + /** + * Deployment ID for deployment in question + */ deploymentId: string; requestBody: UpdateDeploymentEnv; }; -export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostResponse = unknown; +export type UpdateConfigV1DeploymentsDeploymentIdUpdateConfigPostResponse = DeploymentDefinition; export type ListExperimentalFeaturesV1ExperimentalFeaturesGetResponse = { [key: string]: boolean; @@ -1006,21 +2456,39 @@ export type CreateAgentV1AgentsPostData = { export type CreateAgentV1AgentsPostResponse = AgentPublic; export type ListAgentsV1AgentsGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; + /** + * Organization ID to filter results by + */ organizationId?: string | null; + /** + * Agent visibility + */ visibility?: AgentVisibility; }; export type ListAgentsV1AgentsGetResponse = Array; export type GetAgentByIdV1AgentsAgentIdGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; export type GetAgentByIdV1AgentsAgentIdGetResponse = AgentPublic; export type UpdateAgentV1AgentsAgentIdPutData = { + /** + * Agent ID for agent in question + */ agentId: string; requestBody: UpdateAgentRequest; }; @@ -1028,18 +2496,27 @@ export type UpdateAgentV1AgentsAgentIdPutData = { export type UpdateAgentV1AgentsAgentIdPutResponse = AgentPublic; export type DeleteAgentV1AgentsAgentIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; }; export type DeleteAgentV1AgentsAgentIdDeleteResponse = DeleteAgent; -export type GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData = { +export type GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; -export type GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetResponse = Array; +export type GetAgentDeploymentV1AgentsAgentIdDeploymentsGetResponse = Array; export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetData = { + /** + * Agent ID for agent in question + */ agentId: string; }; @@ -1047,6 +2524,9 @@ export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetResponse = Array; export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostData = { + /** + * Agent ID for agent in question + */ agentId: string; requestBody: CreateAgentToolMetadataRequest; }; @@ -1055,7 +2535,13 @@ export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostResponse = AgentToolMetadataPublic; export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * Agent Tool Metadata ID for tool metadata in question + */ agentToolMetadataId: string; requestBody: UpdateAgentToolMetadataRequest; }; @@ -1064,7 +2550,13 @@ export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataI AgentToolMetadata; export type DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * Agent Tool Metadata ID for tool metadata in question + */ agentToolMetadataId: string; }; @@ -1078,14 +2570,26 @@ export type BatchUploadFileV1AgentsBatchUploadFilePostData = { export type BatchUploadFileV1AgentsBatchUploadFilePostResponse = Array; export type GetAgentFileV1AgentsAgentIdFilesFileIdGetData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * File ID for file in question + */ fileId: string; }; export type GetAgentFileV1AgentsAgentIdFilesFileIdGetResponse = FileMetadata; export type DeleteAgentFileV1AgentsAgentIdFilesFileIdDeleteData = { + /** + * Agent ID for agent in question + */ agentId: string; + /** + * File ID for file in question + */ fileId: string; }; @@ -1100,18 +2604,27 @@ export type CreateSnapshotV1SnapshotsPostData = { export type CreateSnapshotV1SnapshotsPostResponse = CreateSnapshotResponse; export type GetSnapshotV1SnapshotsLinkLinkIdGetData = { + /** + * Link ID for the snapshot link in question + */ linkId: string; }; export type GetSnapshotV1SnapshotsLinkLinkIdGetResponse = SnapshotPublic; export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteData = { + /** + * Link ID for the snapshot link in question + */ linkId: string; }; export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteResponse = DeleteSnapshotLinkResponse; export type DeleteSnapshotV1SnapshotsSnapshotIdDeleteData = { + /** + * Snapshot ID for the snapshot in question + */ snapshotId: string; }; @@ -1126,6 +2639,9 @@ export type CreateOrganizationV1OrganizationsPostData = { export type CreateOrganizationV1OrganizationsPostResponse = Organization; export type UpdateOrganizationV1OrganizationsOrganizationIdPutData = { + /** + * Organization ID for the organization in question + */ organizationId: string; requestBody: UpdateOrganization; }; @@ -1133,18 +2649,27 @@ export type UpdateOrganizationV1OrganizationsOrganizationIdPutData = { export type UpdateOrganizationV1OrganizationsOrganizationIdPutResponse = Organization; export type GetOrganizationV1OrganizationsOrganizationIdGetData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; export type GetOrganizationV1OrganizationsOrganizationIdGetResponse = Organization; export type DeleteOrganizationV1OrganizationsOrganizationIdDeleteData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; export type DeleteOrganizationV1OrganizationsOrganizationIdDeleteResponse = DeleteOrganization; export type GetOrganizationUsersV1OrganizationsOrganizationIdUsersGetData = { + /** + * Organization ID for the organization in question + */ organizationId: string; }; @@ -1158,13 +2683,22 @@ export type CreateModelV1ModelsPostData = { export type CreateModelV1ModelsPostResponse = Model; export type ListModelsV1ModelsGetData = { + /** + * Maximum number of records to return per request + */ limit?: number; + /** + * Offset for where request should start returning records from + */ offset?: number; }; export type ListModelsV1ModelsGetResponse = Array; export type UpdateModelV1ModelsModelIdPutData = { + /** + * Model ID for the model in question + */ modelId: string; requestBody: ModelUpdate; }; @@ -1172,20 +2706,35 @@ export type UpdateModelV1ModelsModelIdPutData = { export type UpdateModelV1ModelsModelIdPutResponse = Model; export type GetModelV1ModelsModelIdGetData = { + /** + * Model ID for the model in question + */ modelId: string; }; export type GetModelV1ModelsModelIdGetResponse = Model; export type DeleteModelV1ModelsModelIdDeleteData = { + /** + * Model ID for the model in question + */ modelId: string; }; export type DeleteModelV1ModelsModelIdDeleteResponse = DeleteModel; export type GetUsersScimV2UsersGetData = { + /** + * Maximum number of records to return per request + */ count?: number; + /** + * Filter to use when filtering response + */ filter?: string | null; + /** + * Start Index for request + */ startIndex?: number; }; @@ -1198,6 +2747,9 @@ export type CreateUserScimV2UsersPostData = { export type CreateUserScimV2UsersPostResponse = unknown; export type GetUserScimV2UsersUserIdGetData = { + /** + * User ID for the user in question + */ userId: string; }; @@ -1205,6 +2757,9 @@ export type GetUserScimV2UsersUserIdGetResponse = unknown; export type UpdateUserScimV2UsersUserIdPutData = { requestBody: backend__schemas__scim__UpdateUser; + /** + * User ID for the user in question + */ userId: string; }; @@ -1212,14 +2767,26 @@ export type UpdateUserScimV2UsersUserIdPutResponse = unknown; export type PatchUserScimV2UsersUserIdPatchData = { requestBody: PatchUser; + /** + * User ID for the user in question + */ userId: string; }; export type PatchUserScimV2UsersUserIdPatchResponse = unknown; export type GetGroupsScimV2GroupsGetData = { + /** + * Maximum number of records to return per request + */ count?: number; + /** + * Filter to use when filtering response + */ filter?: string | null; + /** + * Start Index for request + */ startIndex?: number; }; @@ -1232,12 +2799,18 @@ export type CreateGroupScimV2GroupsPostData = { export type CreateGroupScimV2GroupsPostResponse = unknown; export type GetGroupScimV2GroupsGroupIdGetData = { + /** + * Group ID for the group in question + */ groupId: string; }; export type GetGroupScimV2GroupsGroupIdGetResponse = unknown; export type PatchGroupScimV2GroupsGroupIdPatchData = { + /** + * Group ID for the group in question + */ groupId: string; requestBody: PatchGroup; }; @@ -1245,6 +2818,9 @@ export type PatchGroupScimV2GroupsGroupIdPatchData = { export type PatchGroupScimV2GroupsGroupIdPatchResponse = unknown; export type DeleteGroupScimV2GroupsGroupIdDeleteData = { + /** + * Group ID for the group in question + */ groupId: string; }; @@ -1252,8 +2828,6 @@ export type DeleteGroupScimV2GroupsGroupIdDeleteResponse = void; export type HealthHealthGetResponse = unknown; -export type ApplyMigrationsMigratePostResponse = unknown; - export type $OpenApiTs = { '/v1/auth_strategies': { get: { @@ -1709,7 +3283,7 @@ export type $OpenApiTs = { /** * Successful Response */ - 200: unknown; + 200: DeploymentDefinition; /** * Validation Error */ @@ -1800,7 +3374,7 @@ export type $OpenApiTs = { }; '/v1/agents/{agent_id}/deployments': { get: { - req: GetAgentDeploymentsV1AgentsAgentIdDeploymentsGetData; + req: GetAgentDeploymentV1AgentsAgentIdDeploymentsGetData; res: { /** * Successful Response @@ -2274,14 +3848,4 @@ export type $OpenApiTs = { }; }; }; - '/migrate': { - post: { - res: { - /** - * Successful Response - */ - 200: unknown; - }; - }; - }; }; diff --git a/src/interfaces/coral_web/src/components/ConversationList/ConversationCard.tsx b/src/interfaces/coral_web/src/components/ConversationList/ConversationCard.tsx index 053fc17c8b..4d46e3775b 100644 --- a/src/interfaces/coral_web/src/components/ConversationList/ConversationCard.tsx +++ b/src/interfaces/coral_web/src/components/ConversationList/ConversationCard.tsx @@ -16,7 +16,7 @@ export type ConversationListItem = { conversationId: string; updatedAt: string; title: string; - description: string | null; + description: string | null | undefined; weekHeading?: string; };