-
Notifications
You must be signed in to change notification settings - Fork 231
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 #326 from aurelio-labs/james/async-op
feat: async support for pinecone and openai
- Loading branch information
Showing
12 changed files
with
1,388 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "semantic-router" | ||
version = "0.0.46" | ||
version = "0.0.47" | ||
description = "Super fast semantic router for AI decision making" | ||
authors = [ | ||
"James Briggs <[email protected]>", | ||
|
@@ -41,6 +41,7 @@ google-cloud-aiplatform = {version = "^1.45.0", optional = true} | |
requests-mock = "^1.12.1" | ||
boto3 = { version = "^1.34.98", optional = true } | ||
botocore = {version = "^1.34.110", optional = true} | ||
aiohttp = "^3.9.5" | ||
|
||
[tool.poetry.extras] | ||
hybrid = ["pinecone-text"] | ||
|
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 |
---|---|---|
@@ -1,15 +1,22 @@ | ||
from typing import Any, List | ||
from typing import Any, Coroutine, List, Optional | ||
|
||
from pydantic.v1 import BaseModel, Field | ||
from pydantic.v1 import BaseModel, Field, validator | ||
|
||
|
||
class BaseEncoder(BaseModel): | ||
name: str | ||
score_threshold: float | ||
score_threshold: Optional[float] = None | ||
type: str = Field(default="base") | ||
|
||
class Config: | ||
arbitrary_types_allowed = True | ||
|
||
@validator("score_threshold", pre=True, always=True) | ||
def set_score_threshold(cls, v): | ||
return float(v) if v is not None else None | ||
|
||
def __call__(self, docs: List[Any]) -> List[List[float]]: | ||
raise NotImplementedError("Subclasses must implement this method") | ||
|
||
def acall(self, docs: List[Any]) -> Coroutine[Any, Any, List[List[float]]]: | ||
raise NotImplementedError("Subclasses must implement this method") |
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
Oops, something went wrong.