Skip to content

Commit

Permalink
Backend: update openapi spec (#897)
Browse files Browse the repository at this point in the history
* feat(backend): added verbose title and description to FastAPI app

* feat(backend): added verbose title and description to agent schemas

* feat(backend): added verbose title and description to path and query params in agents router

* feat(backend): refactored agent params into params directory

* feat(backend): added tags to agent router

* feat(backend): added verbose title and description to auth schemas and params

* feat(backend): added verbose title and description to chat schemas

* feat(backend): added verbose title and description to chat schemas

* feat(backend): added verbose title and description to conversation params and schemas

* feat(backend): added verbose title and description to deployment params and schemas

* feat(backend): added verbose title and description to schemas

* feat(backend): added verbose title and description to model params and schemas

* feat(backend): added tags to routers

* feat(backend): added verbose title and description to organization params and schemas

* feat(backend): added verbose title and description to scim params and schemas

* feat(backend): added verbose title and description to snapshot params and schemas

* feat(backend): added verbose title and description to tool params and schemas

* fix(backend): added missing query param in conversation router

* feat(backend): added verbose title and description to user params and schemas

* feat(backend): added verbose title and description for oauth code query param

* chore(assistants_web): re-generated client

* chore(backend): revert refactor

* chore(assistants_web): updated CohereClient to use individual services generated by router tags

* feat(backend): use router name for router tag

* chore(assistants_web): re-generated client

* chore(coral_web): re-generated client
  • Loading branch information
ezawadski authored Jan 15, 2025
1 parent d3d20fc commit 6a81440
Show file tree
Hide file tree
Showing 62 changed files with 7,694 additions and 3,228 deletions.
5 changes: 2 additions & 3 deletions src/backend/chat/enums.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 12 additions & 0 deletions src/backend/config/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class RouterName(StrEnum):
CONVERSATION = "conversation"
DEPLOYMENT = "deployment"
EXPERIMENTAL_FEATURES = "experimental_features"
ORGANIZATION = "organization"
TOOL = "tool"
USER = "user"
AGENT = "agent"
Expand Down Expand Up @@ -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),
Expand Down
16 changes: 14 additions & 2 deletions src/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -55,7 +58,12 @@ async def lifespan(app: FastAPI):


def create_app():
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,
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6a81440

Please sign in to comment.