diff --git a/README.md b/README.md index c1156d23..9d4e0728 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ By the way if you to use not mandatory modules it is necessary to install by you ### Installing "Other Language Models" -This group allows you to use additional language models like Fireworks, Groq, Anthropic, Hugging Face, and Nvidia AI Endpoints. +This group allows you to use additional language models like Fireworks, Groq, Anthropic, togheterai, Hugging Face, and Nvidia AI Endpoints. ```bash pip install scrapegraphai[other-language-models] diff --git a/pyproject.toml b/pyproject.toml index 0c3d26aa..75f01c34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,7 @@ other-language-models = [ "langchain-anthropic>=0.1.11", "langchain-huggingface>=0.0.3", "langchain-nvidia-ai-endpoints>=0.1.6", + "together==1.2.9" ] # Group 2: More Semantic Options diff --git a/scrapegraphai/graphs/abstract_graph.py b/scrapegraphai/graphs/abstract_graph.py index 0d02b6d4..78b4e6bc 100644 --- a/scrapegraphai/graphs/abstract_graph.py +++ b/scrapegraphai/graphs/abstract_graph.py @@ -157,10 +157,14 @@ class AbstractGraph(ABC): from langchain_community.chat_models import ErnieBotChat return ErnieBotChat(**llm_params) - if llm_params["model_provider"] == "oneapi": + elif llm_params["model_provider"] == "oneapi": return OneApi(**llm_params) - if llm_params["model_provider"] == "nvidia": + elif llm_params["model_provider"] == "togehterai": + from langhcain_together import ChatTogether + return ChatTogether(**llm_params) + + elif llm_params["model_provider"] == "nvidia": try: from langchain_nvidia_ai_endpoints import ChatNVIDIA except ImportError: diff --git a/scrapegraphai/helpers/models_tokens.py b/scrapegraphai/helpers/models_tokens.py index 556d6ad6..b53a06b5 100644 --- a/scrapegraphai/helpers/models_tokens.py +++ b/scrapegraphai/helpers/models_tokens.py @@ -127,6 +127,9 @@ models_tokens = { "gemma-7b-it": 8192, "claude-3-haiku-20240307'": 8192, }, + "togheterai": { + "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo": 128000 + }, "anthropic": { "claude_instant": 100000, "claude2": 9000,