-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from julep-ai/f/chat-tests
feat(agents-api): Make chat route tests pass
- Loading branch information
Showing
43 changed files
with
348 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from typing import Annotated | ||
|
||
from fastapi import Depends | ||
from pydantic import UUID4 | ||
|
||
import agents_api.clients.embed as embedder | ||
|
||
from ...autogen.openapi_model import ( | ||
EmbedQueryRequest, | ||
EmbedQueryResponse, | ||
) | ||
from ...dependencies.developer_id import get_developer_id | ||
from .router import router | ||
|
||
|
||
@router.post("/embed", tags=["docs"]) | ||
async def embed( | ||
x_developer_id: Annotated[UUID4, Depends(get_developer_id)], | ||
data: EmbedQueryRequest, | ||
) -> EmbedQueryResponse: | ||
text_to_embed: str | list[str] = data.text | ||
text_to_embed: list[str] = ( | ||
[text_to_embed] if isinstance(text_to_embed, str) else text_to_embed | ||
) | ||
|
||
vectors = await embedder.embed(inputs=text_to_embed) | ||
|
||
return EmbedQueryResponse(vectors=vectors) |
Oops, something went wrong.