Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 13, 2024
1 parent 76a3807 commit d2e5df1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion comps/cores/proto/docarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class EmbedDoc(BaseDoc):
fetch_k: int = 20
lambda_mult: float = 0.5
score_threshold: float = 0.2
constraints: Optional[Union[Dict[str, Any], List[Dict[str, Any]],None]] = None
constraints: Optional[Union[Dict[str, Any], List[Dict[str, Any]], None]] = None


class EmbedMultimodalDoc(EmbedDoc):
Expand Down
5 changes: 5 additions & 0 deletions comps/embeddings/multimodal_clip/embedding_multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import time
from typing import List, Optional, Union

from dateparser.search import search_dates
from embeddings_clip import vCLIP

Expand All @@ -23,9 +24,11 @@
EmbeddingResponse,
EmbeddingResponseData,
)

logger = CustomLogger("embedding_multimodal")
logflag = os.getenv("LOGFLAG", False)


def filtler_dates(prompt):

base_date = datetime.datetime.today()
Expand Down Expand Up @@ -108,11 +111,13 @@ async def embedding(
logger.info(res)
return res


async def get_embeddings(text: Union[str, List[str]]) -> List[List[float]]:
texts = [text] if isinstance(text, str) else text
embed_vector = embeddings.embed_query(texts).tolist()
return embed_vector


if __name__ == "__main__":
embeddings = vCLIP({"model_name": "openai/clip-vit-base-patch32", "num_frm": 4})
opea_microservices["opea_service@embedding_multimodal"].start()

0 comments on commit d2e5df1

Please sign in to comment.