pull/430/head
Kye 10 months ago
parent 9b225e955b
commit 0a48a97bf6

@ -9,8 +9,9 @@ from langchain_experimental.autonomous_agents.hugginggpt.task_planner import (
load_chat_planner, load_chat_planner,
) )
from transformers import load_tool from transformers import load_tool
from swarms.utils.loguru_logger import logger
from swarms.structs.agent import Agent from swarms.structs.agent import Agent
from swarms.utils.loguru_logger import logger
class OmniModalAgent(Agent): class OmniModalAgent(Agent):

@ -1,18 +1,13 @@
import os
from typing import List from typing import List
# import faiss
from langchain.docstore import InMemoryDocstore
from langchain.embeddings import OpenAIEmbeddings
# from langchain.vectorstores import FAISS
from langchain_experimental.autonomous_agents import AutoGPT from langchain_experimental.autonomous_agents import AutoGPT
from swarms.structs.agent import Agent
from swarms.tools.tool import BaseTool from swarms.tools.tool import BaseTool
from swarms.utils.decorators import error_decorator, timing_decorator from swarms.utils.decorators import error_decorator, timing_decorator
class Worker: class Worker(Agent):
""" """
The Worker class represents an autonomous agent that can perform tassks through The Worker class represents an autonomous agent that can perform tassks through
function calls or by running a chat. function calls or by running a chat.

@ -9,13 +9,14 @@ from dotenv import load_dotenv
from swarms.utils.data_to_text import data_to_text from swarms.utils.data_to_text import data_to_text
from swarms.utils.markdown_message import display_markdown_message from swarms.utils.markdown_message import display_markdown_message
from swarms.memory.base_vectordb import AbstractVectorDatabase
# Load environment variables # Load environment variables
load_dotenv() load_dotenv()
# Results storage using local ChromaDB # Results storage using local ChromaDB
class ChromaDB: class ChromaDB(AbstractVectorDatabase):
""" """
ChromaDB database ChromaDB database

@ -6,8 +6,8 @@ from langchain.chains.question_answering import load_qa_chain
from langchain.embeddings.openai import OpenAIEmbeddings from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Chroma from langchain.vectorstores import Chroma
from swarms.models.popular_llms import OpenAIChat
from swarms.models.openai_models import OpenAIChat from swarms.memory.base_vectordb import AbstractVectorDatabase
def synchronized_mem(method): def synchronized_mem(method):
@ -31,7 +31,7 @@ def synchronized_mem(method):
return wrapper return wrapper
class LangchainChromaVectorMemory: class LangchainChromaVectorMemory(AbstractVectorDatabase):
""" """
A class representing a vector memory for storing and retrieving text entries. A class representing a vector memory for storing and retrieving text entries.

@ -5,9 +5,10 @@ from sqlalchemy import JSON, Column, String, create_engine
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from swarms.memory.base_vectordb import AbstractVectorDatabase
class PostgresDB: class PostgresDB(AbstractVectorDatabase):
""" """
A class representing a Postgres database. A class representing a Postgres database.
@ -67,7 +68,7 @@ class PostgresDB:
return VectorModel return VectorModel
def add_or_update_vector( def add(
self, self,
vector: str, vector: str,
vector_id: Optional[str] = None, vector_id: Optional[str] = None,
@ -97,7 +98,7 @@ class PostgresDB:
except Exception as e: except Exception as e:
print(f"Error adding or updating vector: {e}") print(f"Error adding or updating vector: {e}")
def query_vectors( def query(
self, query: Any, namespace: Optional[str] = None self, query: Any, namespace: Optional[str] = None
) -> List[Any]: ) -> List[Any]:
""" """

@ -1,6 +1,7 @@
from typing import List from typing import List
from httpx import RequestError from httpx import RequestError
from swarms.memory.base_vectordb import AbstractVectorDatabase
try: try:
from sentence_transformers import SentenceTransformer from sentence_transformers import SentenceTransformer
@ -20,7 +21,7 @@ except ImportError:
print("pip install qdrant-client") print("pip install qdrant-client")
class Qdrant: class Qdrant(AbstractVectorDatabase):
""" """
Qdrant class for managing collections and performing vector operations using QdrantClient. Qdrant class for managing collections and performing vector operations using QdrantClient.

@ -25,7 +25,6 @@ class SequentialAccountingSwarm(AbstractSwarm):
Run the swarm simulation. Run the swarm simulation.
""" """
def __init__( def __init__(
self, self,
name: Optional[str] = "kyegomez/sequential-accounting-swarm", name: Optional[str] = "kyegomez/sequential-accounting-swarm",
@ -35,6 +34,8 @@ class SequentialAccountingSwarm(AbstractSwarm):
iters: Optional[int] = 100, iters: Optional[int] = 100,
max_agents: Optional[int] = 100, max_agents: Optional[int] = 100,
agents: Sequence[AbstractLLM] = None, agents: Sequence[AbstractLLM] = None,
*args,
**kwargs,
): ):
super().__init__() super().__init__()
self.name = name self.name = name
@ -98,6 +99,8 @@ class AutoSwarmRouter(AbstractSwarm):
custom_preprocess: Optional[Callable] = None, custom_preprocess: Optional[Callable] = None,
custom_postprocess: Optional[Callable] = None, custom_postprocess: Optional[Callable] = None,
custom_router: Optional[Callable] = None, custom_router: Optional[Callable] = None,
*args,
**kwargs,
): ):
super().__init__() super().__init__()
self.name = name self.name = name

Loading…
Cancel
Save