pull/30/head
Kye 1 year ago
parent 063a878b5a
commit ec8b8be28d

@ -1,4 +1,4 @@
## Swarming AI Agents (Swarms)
## Swarms of Autonomous AI Agents
![Swarming banner](images/swarms.png)

@ -24,7 +24,7 @@ from langchain.schema import (
NoOpOutputParser,
PromptValue,
)
from langchain.schema.language_model import BaseLanguageModel
from langchain.base_language import BaseLanguageModel
class LLMChain(Chain):

@ -7,8 +7,6 @@ from dataclasses import dataclass
from io import BytesIO
from typing import Any, List, Optional, Sequence, Tuple, Union
from pydantic import BaseModel, BaseSettings, root_validator
from langchain.agents import AgentExecutor, BaseSingleActionAgent
from langchain.base_language import BaseLanguageModel
from langchain.callbacks import AsyncIteratorCallbackHandler
@ -36,8 +34,7 @@ from langchain.schema import (
)
from langchain.tools import BaseTool, StructuredTool
from langchain.tools.convert_to_openai import format_tool_to_openai_function
from pydantic import BaseModel, BaseSettings, root_validator
remove_dl_link_prompt = ChatPromptTemplate(
input_variables=["input_response"],
@ -295,7 +292,7 @@ class File(BaseModel):
return f"File(name={self.name})"
from langchain.schema import HumanMessage, AIMessage # type: ignore
from langchain.schema import AIMessage, HumanMessage # type: ignore
class UserRequest(HumanMessage):

@ -8,9 +8,8 @@ from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
import yaml
from pydantic import BaseModel, root_validator
from langchain.agents.agent_types import AgentType
from langchain.base_language import BaseLanguageModel
from langchain.callbacks.base import BaseCallbackManager
from langchain.callbacks.manager import (
AsyncCallbackManagerForToolRun,
@ -26,9 +25,9 @@ from langchain.schema import (
BaseOutputParser,
BasePromptTemplate,
)
from langchain.schema.language_model import BaseLanguageModel
from langchain.schema.messages import BaseMessage
from langchain.tools.base import BaseTool
from pydantic import BaseModel, root_validator
logger = logging.getLogger(__name__)

@ -1,12 +1,13 @@
from typing import Any, Dict, List, Optional, Union
from celery import Task
from langchain.callbacks.base import BaseCallbackHandler
from langchain.schema import AgentAction, AgentFinish, LLMResult
from celery import Task
from swarms.utils.logger import logger
# from ansi import ANSI, Color, Style, dim_multiline
from swarms.utils.main import ANSI, Color, Style, dim_multiline
from swarms.utils.logger import logger
class EVALCallbackHandler(BaseCallbackHandler):

@ -1,13 +1,12 @@
"""OpenAI chat wrapper."""
from __future__ import annotations
import os
import logging
import os
import sys
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple
import openai
from langchain.chat_models.base import BaseChatModel
from langchain.schema import (
AIMessage,
@ -18,9 +17,7 @@ from langchain.schema import (
HumanMessage,
SystemMessage,
)
from langchain.utils import get_from_dict_or_env
from swarms.utils.logger import logger
from pydantic import BaseModel, Extra, Field, root_validator
from tenacity import (
before_sleep_log,
@ -30,10 +27,11 @@ from tenacity import (
wait_exponential,
)
from swarms.utils.logger import logger
# from ansi import ANSI, Color, Style
from swarms.utils.main import ANSI, Color, Style
import os
def _create_retry_decorator(llm: ChatOpenAI) -> Callable[[Any], Any]:
import openai

@ -1,10 +1,10 @@
from typing import Any, List, Optional, Sequence, Tuple
import logging
from typing import Any, List, Optional, Sequence, Tuple
from swarms.agents.utils.Agent import Agent
from langchain.agents.agent import AgentOutputParser
from langchain.base_language import BaseLanguageModel
from langchain.callbacks.base import BaseCallbackManager
from langchain.chains import LLMChain
from langchain.schema import BaseOutputParser
from langchain.prompts.base import BasePromptTemplate
from langchain.prompts.chat import (
ChatPromptTemplate,
@ -15,20 +15,14 @@ from langchain.prompts.chat import (
from langchain.schema import (
AgentAction,
AIMessage,
BaseLanguageModel,
BaseMessage,
BaseOutputParser,
HumanMessage,
)
from langchain.tools.base import BaseTool
from langchain.agents.agent import AgentOutputParser
from langchain.schema import AgentAction
from swarms.agents.prompts.prompts import EVAL_TOOL_RESPONSE
from swarms.agents.utils.Agent import Agent
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

@ -1,21 +1,19 @@
import os
from swarms.agents.prompts.prompts import EVAL_PREFIX, EVAL_SUFFIX
from swarms.agents.tools.main import BaseToolSet
from swarms.agents.tools.main import ToolsFactory
from langchain.callbacks.base import BaseCallbackManager
# from .ChatOpenAI import ChatOpenAI
from langchain.chat_models import ChatOpenAI
from langchain.chat_models.base import BaseChatModel
from langchain.schema import BaseOutputParser
from langchain.callbacks.base import BaseCallbackManager
from swarms.agents.prompts.prompts import EVAL_PREFIX, EVAL_SUFFIX
from swarms.agents.tools.main import BaseToolSet, ToolsFactory
from .ConversationalChatAgent import ConversationalChatAgent
# from .ChatOpenAI import ChatOpenAI
from langchain.chat_models import ChatOpenAI
from .output_parser import EvalOutputParser
class AgentSetup:
def __init__(self, toolsets: list[BaseToolSet] = [], openai_api_key: str = None, serpapi_api_key: str = None, bing_search_url: str = None, bing_subscription_key: str = None):
self.llm: BaseChatModel = None

@ -3,16 +3,14 @@ import re
from datetime import datetime
from typing import Any, Dict, List, Optional
from langchain import LLMChain
from langchain.base_language import BaseLanguageModel
############
from langchain.prompts import PromptTemplate
from langchain.retrievers import TimeWeightedVectorStoreRetriever
from langchain.schema import BaseMemory, Document
from langchain.schema.language_model import BaseLanguageModel
from langchain.utils import mock_now
from langchain import LLMChain
from langchain.schema.language_model import BaseLanguageModel
logger = logging.getLogger(__name__)

Loading…
Cancel
Save