Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm - Add aiohttp dependency #645

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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