Skip to content

Commit

Permalink
Merge pull request #645 from MichaelDecent/dev.5.1
Browse files Browse the repository at this point in the history
swarm - Add `aiohttp` dependency
  • Loading branch information
cobycloud authored Oct 15, 2024
2 parents d82326e + 55dbdf6 commit e1d145a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions pkgs/swarmauri/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ torch = "*"
yake = "==0.4.8"
tf-keras = "==2.17.0"
deepface = "*"
aiohttp = "*"


# Pacmap requires specific version of numba
Expand Down
1 change: 1 addition & 0 deletions pkgs/swarmauri/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"tf-keras==2.17.0",
"yake==0.4.8",
"deepface",
"aiohttp",
],
classifiers=[
"License :: OSI Approved :: Apache Software License",
Expand Down
13 changes: 5 additions & 8 deletions pkgs/swarmauri/swarmauri/embeddings/concrete/MistralEmbedding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mistralai import Mistral
import mistralai
from typing import List, Literal
from pydantic import PrivateAttr
from swarmauri.vectors.concrete.Vector import Vector
Expand Down Expand Up @@ -26,14 +26,11 @@ class MistralEmbedding(EmbeddingBase):

type: Literal["MistralEmbedding"] = "MistralEmbedding"

_allowed_models: List[str] = PrivateAttr(
default=["mistral-embed"]
)

_allowed_models: List[str] = PrivateAttr(default=["mistral-embed"])

model: str = "mistral-embed"
api_key: str = None
_client: Mistral = PrivateAttr()
_client: mistralai.Mistral = PrivateAttr()

def __init__(
self,
Expand All @@ -49,7 +46,7 @@ def __init__(
)

self.model = model
self._client = Mistral(api_key=api_key)
self._client = mistralai.Mistral(api_key=api_key)

def infer_vector(self, data: List[str]) -> List[Vector]:
"""
Expand All @@ -71,7 +68,7 @@ def infer_vector(self, data: List[str]) -> List[Vector]:
model=self.model,
inputs=data,
)

embeddings = [Vector(value=item.embedding) for item in response.data]
return embeddings

Expand Down
3 changes: 0 additions & 3 deletions pkgs/swarmauri/swarmauri/llms/concrete/PerplexityModel.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import asyncio
import json
from typing import List, Dict, Literal, Optional
import requests
import aiohttp # for async requests
from sqlalchemy.testing.plugin.plugin_base import logging
from swarmauri_core.typing import SubclassUnion
from swarmauri.messages.base.MessageBase import MessageBase
from swarmauri.messages.concrete.AgentMessage import AgentMessage
from swarmauri.llms.base.LLMBase import LLMBase
import logging


class PerplexityModel(LLMBase):
Expand Down

0 comments on commit e1d145a

Please sign in to comment.