From ac18bc88cb6ef5444775511f0d5b72a5b8058aba Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Fri, 16 Feb 2024 16:11:26 -0700 Subject: [PATCH] typo --- .../langchain_example/langchain_example.py | 2 +- playground/memory/qdrant/usage_example.py | 2 +- playground/structs/debate_example.py | 8 ++++---- swarms/agents/omni_modal_agent.py | 2 +- swarms/agents/worker_agent.py | 6 +++--- swarms/models/anthropic.py | 16 +++++++-------- swarms/models/cohere_chat.py | 12 +++++------ swarms/models/eleven_labs.py | 2 +- swarms/models/openai_embeddings.py | 4 ++-- swarms/models/openai_models.py | 20 +++++++++---------- swarms/models/palm.py | 10 +++++----- swarms/prompts/base.py | 6 +++--- swarms/structs/document.py | 2 +- swarms/structs/multi_agent_collab.py | 2 +- swarms/tools/exec_tool.py | 2 +- swarms/tools/tool.py | 8 ++++---- swarms/utils/README.md | 6 +++--- tests/models/test_elevenlab.py | 2 +- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/playground/demos/langchain_example/langchain_example.py b/playground/demos/langchain_example/langchain_example.py index 70397171..97db080b 100644 --- a/playground/demos/langchain_example/langchain_example.py +++ b/playground/demos/langchain_example/langchain_example.py @@ -1,7 +1,7 @@ import os from dotenv import load_dotenv from swarms import Agent -from langchain_communityllms import OpenAIChat +from langchain_community.llms import OpenAIChat # Loading environment variables from .env file load_dotenv() diff --git a/playground/memory/qdrant/usage_example.py b/playground/memory/qdrant/usage_example.py index 5afc393c..36a3fcd5 100644 --- a/playground/memory/qdrant/usage_example.py +++ b/playground/memory/qdrant/usage_example.py @@ -1,4 +1,4 @@ -from langchain_communitydocument_loaders import CSVLoader +from langchain_community.document_loaders import CSVLoader from swarms.memory import qdrant loader = CSVLoader( diff --git a/playground/structs/debate_example.py b/playground/structs/debate_example.py index 0ca40501..932f00b2 100644 --- a/playground/structs/debate_example.py +++ b/playground/structs/debate_example.py @@ -2,10 +2,10 @@ from typing import Callable, List import numpy as np import tenacity -from langchain_communitychat_models import ChatOpenAI -from langchain_communityoutput_parsers import RegexParser -from langchain_communityprompts import PromptTemplate -from langchain_communityschema import ( +from langchain_community.chat_models import ChatOpenAI +from langchain_community.output_parsers import RegexParser +from langchain_community.prompts import PromptTemplate +from langchain_community.schema import ( HumanMessage, SystemMessage, ) diff --git a/swarms/agents/omni_modal_agent.py b/swarms/agents/omni_modal_agent.py index 65378dab..4f9e4637 100644 --- a/swarms/agents/omni_modal_agent.py +++ b/swarms/agents/omni_modal_agent.py @@ -1,4 +1,4 @@ -from langchain_communitybase_language import BaseLanguageModel +from langchain_community.base_language import BaseLanguageModel from langchain_experimental.autonomous_agents.hugginggpt.repsonse_generator import ( load_response_generator, ) diff --git a/swarms/agents/worker_agent.py b/swarms/agents/worker_agent.py index f3185492..389f2ee5 100644 --- a/swarms/agents/worker_agent.py +++ b/swarms/agents/worker_agent.py @@ -2,9 +2,9 @@ import os from typing import Any, List import faiss -from langchain_communitydocstore import InMemoryDocstore -from langchain_communityembeddings import OpenAIEmbeddings -from langchain_communityvectorstores import FAISS +from langchain_community.docstore import InMemoryDocstore +from langchain_community.embeddings import OpenAIEmbeddings +from langchain_community.vectorstores import FAISS from langchain_experimental.autonomous_agents import AutoGPT from swarms.utils.decorators import error_decorator, timing_decorator diff --git a/swarms/models/anthropic.py b/swarms/models/anthropic.py index f03d469c..7cf5bc6e 100644 --- a/swarms/models/anthropic.py +++ b/swarms/models/anthropic.py @@ -19,16 +19,16 @@ from typing import ( Union, ) -from langchain_communitycallbacks.manager import ( +from langchain_community.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) -from langchain_communityllms.base import LLM +from langchain_community.llms.base import LLM from pydantic import Field, SecretStr, root_validator -from langchain_communityschema.language_model import BaseLanguageModel -from langchain_communityschema.output import GenerationChunk -from langchain_communityschema.prompt import PromptValue -from langchain_communityutils import ( +from langchain_community.schema.language_model import BaseLanguageModel +from langchain_community.schema.output import GenerationChunk +from langchain_community.schema.prompt import PromptValue +from langchain_community.utils import ( get_from_dict_or_env, ) from packaging.version import parse @@ -360,7 +360,7 @@ class Anthropic(LLM, _AnthropicCommon): .. code-block:: python import anthropic - from langchain_communityllms import Anthropic + from langchain_community.llms import Anthropic model = Anthropic(model="", anthropic_api_key="my-api-key") @@ -386,7 +386,7 @@ class Anthropic(LLM, _AnthropicCommon): """Raise warning that this class is deprecated.""" warnings.warn( "This Anthropic LLM is deprecated. Please use `from" - " langchain_communitychat_models import ChatAnthropic` instead" + " langchain_community.chat_models import ChatAnthropic` instead" ) return values diff --git a/swarms/models/cohere_chat.py b/swarms/models/cohere_chat.py index 6271172b..4eba82b8 100644 --- a/swarms/models/cohere_chat.py +++ b/swarms/models/cohere_chat.py @@ -9,15 +9,15 @@ from tenacity import ( wait_exponential, ) -from langchain_communitycallbacks.manager import ( +from langchain_community.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) -from langchain_communityllms.base import LLM -from langchain_communityllms.utils import enforce_stop_tokens -from langchain_communityload.serializable import Serializable +from langchain_community.llms.base import LLM +from langchain_community.llms.utils import enforce_stop_tokens +from langchain_community.load.serializable import Serializable from pydantic import Extra, Field, root_validator -from langchain_communityutils import get_from_dict_or_env +from langchain_community.utils import get_from_dict_or_env logger = logging.getLogger(__name__) @@ -119,7 +119,7 @@ class Cohere(LLM, BaseCohere): Example: .. code-block:: python - from langchain_communityllms import Cohere + from langchain_community.llms import Cohere cohere = Cohere(model="gptd-instruct-tft", cohere_api_key="my-api-key") """ diff --git a/swarms/models/eleven_labs.py b/swarms/models/eleven_labs.py index a488cffa..7c7b9109 100644 --- a/swarms/models/eleven_labs.py +++ b/swarms/models/eleven_labs.py @@ -2,7 +2,7 @@ import tempfile from enum import Enum from typing import Any, Dict, Union -from langchain_communityutils import get_from_dict_or_env +from langchain_community.utils import get_from_dict_or_env from pydantic import root_validator from swarms.tools.tool import BaseTool diff --git a/swarms/models/openai_embeddings.py b/swarms/models/openai_embeddings.py index ca0ca298..796362ab 100644 --- a/swarms/models/openai_embeddings.py +++ b/swarms/models/openai_embeddings.py @@ -155,7 +155,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings): Example: .. code-block:: python - from langchain_communityembeddings import OpenAIEmbeddings + from langchain_community.embeddings import OpenAIEmbeddings openai = OpenAIEmbeddings(openai_api_key="my-api-key") In order to use the library with Microsoft Azure endpoints, you need to set @@ -174,7 +174,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings): os.environ["OPENAI_API_VERSION"] = "2023-05-15" os.environ["OPENAI_PROXY"] = "http://your-corporate-proxy:8080" - from langchain_communityembeddings.openai import OpenAIEmbeddings + from langchain_community.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings( deployment="your-embeddings-deployment-name", model="your-embeddings-model-name", diff --git a/swarms/models/openai_models.py b/swarms/models/openai_models.py index c7f817e3..8fb124f4 100644 --- a/swarms/models/openai_models.py +++ b/swarms/models/openai_models.py @@ -22,19 +22,19 @@ from typing import ( Union, ) -from langchain_communitycallbacks.manager import ( +from langchain_community.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) -from langchain_communityllms.base import BaseLLM -from langchain_communitypydantic_v1 import Field, root_validator -from langchain_communityschema import Generation, LLMResult -from langchain_communityschema.output import GenerationChunk -from langchain_communityutils import ( +from langchain_community.llms.base import BaseLLM +from langchain_community.pydantic_v1 import Field, root_validator +from langchain_community.schema import Generation, LLMResult +from langchain_community.schema.output import GenerationChunk +from langchain_community.utils import ( get_from_dict_or_env, get_pydantic_field_names, ) -from langchain_communityutils.utils import build_extra_kwargs +from langchain_community.utils.utils import build_extra_kwargs from tenacity import ( RetryCallState, before_sleep_log, @@ -785,7 +785,7 @@ class OpenAI(BaseOpenAI): Example: .. code-block:: python - from langchain_communityllms import OpenAI + from langchain_community.llms import OpenAI openai = OpenAI(model_name="text-davinci-003") """ @@ -809,7 +809,7 @@ class AzureOpenAI(BaseOpenAI): Example: .. code-block:: python - from langchain_communityllms import AzureOpenAI + from langchain_community.llms import AzureOpenAI openai = AzureOpenAI(model_name="text-davinci-003") """ @@ -886,7 +886,7 @@ class OpenAIChat(BaseLLM): Example: .. code-block:: python - from langchain_communityllms import OpenAIChat + from langchain_community.llms import OpenAIChat openaichat = OpenAIChat(model_name="gpt-3.5-turbo") """ diff --git a/swarms/models/palm.py b/swarms/models/palm.py index fa743d2f..5960aaa2 100644 --- a/swarms/models/palm.py +++ b/swarms/models/palm.py @@ -3,11 +3,11 @@ from __future__ import annotations import logging from typing import Any, Callable, Dict, List, Optional -from langchain_communitycallbacks.manager import CallbackManagerForLLMRun -from langchain_communityllms import BaseLLM -from langchain_communitypydantic_v1 import BaseModel, root_validator -from langchain_communityschema import Generation, LLMResult -from langchain_communityutils import get_from_dict_or_env +from langchain_community.callbacks.manager import CallbackManagerForLLMRun +from langchain_community.llms import BaseLLM +from langchain_community.pydantic_v1 import BaseModel, root_validator +from langchain_community.schema import Generation, LLMResult +from langchain_community.utils import get_from_dict_or_env from tenacity import ( before_sleep_log, retry, diff --git a/swarms/prompts/base.py b/swarms/prompts/base.py index 290265c9..c9152e83 100644 --- a/swarms/prompts/base.py +++ b/swarms/prompts/base.py @@ -8,7 +8,7 @@ from pydantic import Field from swarms.utils.serializable import Serializable if TYPE_CHECKING: - from langchain_communityprompts.chat import ChatPromptTemplate + from langchain_community.prompts.chat import ChatPromptTemplate def get_buffer_string( @@ -29,7 +29,7 @@ def get_buffer_string( Example: .. code-block:: python - from langchain_communityschema import AIMessage, HumanMessage + from langchain_community.schema import AIMessage, HumanMessage messages = [ HumanMessage(content="Hi, how are you?"), @@ -86,7 +86,7 @@ class BaseMessage(Serializable): return True def __add__(self, other: Any) -> ChatPromptTemplate: - from langchain_communityprompts.chat import ChatPromptTemplate + from langchain_community.prompts.chat import ChatPromptTemplate prompt = ChatPromptTemplate(messages=[self]) return prompt + other diff --git a/swarms/structs/document.py b/swarms/structs/document.py index 1146cdb0..3b4e5887 100644 --- a/swarms/structs/document.py +++ b/swarms/structs/document.py @@ -5,7 +5,7 @@ from abc import ABC, abstractmethod from functools import partial from typing import Any, Literal, Sequence -from langchain_communityload.serializable import Serializable +from langchain_community.load.serializable import Serializable from pydantic import Field diff --git a/swarms/structs/multi_agent_collab.py b/swarms/structs/multi_agent_collab.py index 1d9b7be4..39af96b7 100644 --- a/swarms/structs/multi_agent_collab.py +++ b/swarms/structs/multi_agent_collab.py @@ -3,7 +3,7 @@ import random from typing import List import tenacity -from langchain_communityoutput_parsers import RegexParser +from langchain_community.output_parsers import RegexParser from swarms.structs.agent import Agent from swarms.utils.logger import logger diff --git a/swarms/tools/exec_tool.py b/swarms/tools/exec_tool.py index 066301df..70b3b08c 100644 --- a/swarms/tools/exec_tool.py +++ b/swarms/tools/exec_tool.py @@ -3,7 +3,7 @@ import re from abc import abstractmethod from typing import Dict, List, NamedTuple -from langchain_communityschema import BaseOutputParser +from langchain_community.schema import BaseOutputParser from pydantic import ValidationError from swarms.tools.tool import BaseTool diff --git a/swarms/tools/tool.py b/swarms/tools/tool.py index 7045f780..2f88b6fc 100644 --- a/swarms/tools/tool.py +++ b/swarms/tools/tool.py @@ -19,8 +19,8 @@ from typing import ( Union, ) -from langchain_communitycallbacks.base import BaseCallbackManager -from langchain_communitycallbacks.manager import ( +from langchain_community.callbacks.base import BaseCallbackManager +from langchain_community.callbacks.manager import ( AsyncCallbackManager, AsyncCallbackManagerForToolRun, CallbackManager, @@ -28,7 +28,7 @@ from langchain_communitycallbacks.manager import ( Callbacks, ) -from langchain_communityload.serializable import Serializable +from langchain_community.load.serializable import Serializable from pydantic import ( BaseModel, Extra, @@ -37,7 +37,7 @@ from pydantic import ( root_validator, validate_arguments, ) -from langchain_communityschema.runnable import ( +from langchain_community.schema.runnable import ( Runnable, RunnableConfig, RunnableSerializable, diff --git a/swarms/utils/README.md b/swarms/utils/README.md index 839d756d..61314a90 100644 --- a/swarms/utils/README.md +++ b/swarms/utils/README.md @@ -100,9 +100,9 @@ Here's the pseudocode algorithm for a `WorkerNode` class that includes a vector In Python, this could look something like: ```python -from langchain_communityvectorstores import FAISS -from langchain_communitydocstore import InMemoryDocstore -from langchain_communityembeddings import OpenAIEmbeddings +from langchain_community.vectorstores import FAISS +from langchain_community.docstore import InMemoryDocstore +from langchain_community.embeddings import OpenAIEmbeddings import faiss from swarms.workers.auto_agent import AutoGPT from collections import deque diff --git a/tests/models/test_elevenlab.py b/tests/models/test_elevenlab.py index ebb8c4f7..8ef8939d 100644 --- a/tests/models/test_elevenlab.py +++ b/tests/models/test_elevenlab.py @@ -47,7 +47,7 @@ def test_stream_speech(eleven_labs_tool): # Testing fixture and environment variables def test_api_key_validation(eleven_labs_tool): with patch( - "langchain_communityutils.get_from_dict_or_env", return_value=API_KEY + "langchain_community.utils.get_from_dict_or_env", return_value=API_KEY ): values = {"eleven_api_key": None} validated_values = eleven_labs_tool.validate_environment(