swarms.agents.models -> swarms.models

pull/53/head
Kye 1 year ago
parent aa3eee31bd
commit ff0d47bd3d

@ -120,7 +120,7 @@ google_palm = GooglePalm()\
messages = [{"role": "system", "content": "You are a funny assistant"}, {"role": "user", "content": "Crack me a joke"}]\ messages = [{"role": "system", "content": "You are a funny assistant"}, {"role": "user", "content": "Crack me a joke"}]\
response = google_palm.generate(messages) response = google_palm.generate(messages)
4\. Anthropic (swarms.agents.models.Anthropic) 4\. Anthropic (swarms.models.Anthropic)
============================================== ==============================================
Anthropic's models, with their mysterious allure, are now at your fingertips. Anthropic's models, with their mysterious allure, are now at your fingertips.

@ -8,7 +8,7 @@ Welcome to the documentation for the llm section of the swarms package, designed
3. [Google PaLM](#google-palm) 3. [Google PaLM](#google-palm)
4. [Anthropic](#anthropic) 4. [Anthropic](#anthropic)
### 1. OpenAI (swarms.agents.models.OpenAI) ### 1. OpenAI (swarms.models.OpenAI)
The OpenAI class provides an interface to interact with OpenAI's language models. It allows both synchronous and asynchronous interactions. The OpenAI class provides an interface to interact with OpenAI's language models. It allows both synchronous and asynchronous interactions.
@ -46,7 +46,7 @@ async_responses = asyncio.run(chat.ask_multiple(ids, "How is {id}?"))
print(async_responses) print(async_responses)
``` ```
### 2. HuggingFace (swarms.agents.models.HuggingFaceLLM) ### 2. HuggingFace (swarms.models.HuggingFaceLLM)
The HuggingFaceLLM class allows interaction with language models from Hugging Face. The HuggingFaceLLM class allows interaction with language models from Hugging Face.
@ -77,7 +77,7 @@ generated_text = hugging_face_model.generate(prompt)
print(generated_text) print(generated_text)
``` ```
### 3. Google PaLM (swarms.agents.models.GooglePalm) ### 3. Google PaLM (swarms.models.GooglePalm)
The GooglePalm class provides an interface for Google's PaLM Chat API. The GooglePalm class provides an interface for Google's PaLM Chat API.
@ -109,7 +109,7 @@ response = google_palm.generate(messages)
print(response["choices"][0]["text"]) print(response["choices"][0]["text"])
``` ```
### 4. Anthropic (swarms.agents.models.Anthropic) ### 4. Anthropic (swarms.models.Anthropic)
The Anthropic class enables interaction with Anthropic's large language models. The Anthropic class enables interaction with Anthropic's large language models.

@ -21,7 +21,7 @@ from langchain.schema import (
) )
from langchain.tools.base import BaseTool from langchain.tools.base import BaseTool
from swarms.agents.models.prompts.prebuild.multi_modal_prompts import EVAL_TOOL_RESPONSE from swarms.models.prompts.prebuild.multi_modal_prompts import EVAL_TOOL_RESPONSE
from swarms.agents.utils.Agent import Agent from swarms.agents.utils.Agent import Agent
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

@ -7,7 +7,7 @@ from langchain.chat_models import ChatOpenAI
from langchain.chat_models.base import BaseChatModel from langchain.chat_models.base import BaseChatModel
from langchain.schema import BaseOutputParser from langchain.schema import BaseOutputParser
from swarms.agents.models.prompts.prebuild.multi_modal_prompts import EVAL_PREFIX, EVAL_SUFFIX from swarms.models.prompts.prebuild.multi_modal_prompts import EVAL_PREFIX, EVAL_SUFFIX
from swarms.tools.main import BaseToolSet, ToolsFactory from swarms.tools.main import BaseToolSet, ToolsFactory
from .ConversationalChatAgent import ConversationalChatAgent from .ConversationalChatAgent import ConversationalChatAgent

@ -5,7 +5,7 @@ from typing import Dict, NamedTuple
from langchain.schema import BaseOutputParser from langchain.schema import BaseOutputParser
from swarms.agents.models.prompts.prebuild.multi_modal_prompts import EVAL_FORMAT_INSTRUCTIONS from swarms.models.prompts.prebuild.multi_modal_prompts import EVAL_FORMAT_INSTRUCTIONS
class EvalOutputParser(BaseOutputParser): class EvalOutputParser(BaseOutputParser):

@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional, Tuple
from langchain.memory.utils import get_prompt_input_key from langchain.memory.utils import get_prompt_input_key
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from swarms.agents.models.prompts.base import AIMessage, BaseMessage, HumanMessage from swarms.models.prompts.base import AIMessage, BaseMessage, HumanMessage
from swarms.utils.serializable import Serializable from swarms.utils.serializable import Serializable

@ -1,6 +1,6 @@
import time import time
from typing import Any, Callable, List from typing import Any, Callable, List
from swarms.agents.models.prompts.agent_prompt_generator import get_prompt from swarms.models.prompts.agent_prompt_generator import get_prompt
class TokenUtils: class TokenUtils:
@staticmethod @staticmethod

@ -18,7 +18,7 @@ from transformers import (
CLIPSegProcessor, CLIPSegProcessor,
) )
from swarms.agents.models.prompts.prebuild.multi_modal_prompts import IMAGE_PROMPT from swarms.models.prompts.prebuild.multi_modal_prompts import IMAGE_PROMPT
from swarms.tools.base import tool from swarms.tools.base import tool
from swarms.tools.main import BaseToolSet from swarms.tools.main import BaseToolSet
from swarms.utils.logger import logger from swarms.utils.logger import logger

@ -400,7 +400,7 @@ class FileHandler:
#############===========================> #############===========================>
from swarms.agents.models.prompts.prebuild.multi_modal_prompts import DATAFRAME_PROMPT from swarms.models.prompts.prebuild.multi_modal_prompts import DATAFRAME_PROMPT
import pandas as pd import pandas as pd
class CsvToDataframe(BaseHandler): class CsvToDataframe(BaseHandler):

@ -3,7 +3,7 @@ import os
from unittest.mock import patch from unittest.mock import patch
from langchain import HuggingFaceHub, ChatOpenAI from langchain import HuggingFaceHub, ChatOpenAI
from swarms.agents.models.llm import LLM from swarms.models.llm import LLM
class TestLLM(unittest.TestCase): class TestLLM(unittest.TestCase):
@patch.object(HuggingFaceHub, '__init__', return_value=None) @patch.object(HuggingFaceHub, '__init__', return_value=None)

@ -1,7 +1,7 @@
import pytest import pytest
import torch import torch
from unittest.mock import Mock from unittest.mock import Mock
from swarms.agents.models.huggingface import HuggingFaceLLM from swarms.models.huggingface import HuggingFaceLLM
@pytest.fixture @pytest.fixture

Loading…
Cancel
Save