mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-25 21:11:11 +08:00
Merge pull request #183 from VinciGit00/182-googlegenerativeaiembeddings-is-not-defined
fixed gemini embeddings
This commit is contained in:
commit
7e00c1497e
3346
poetry.lock
generated
Normal file
3346
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,16 +4,16 @@ AbstractGraph Module
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Optional
|
||||
from langchain_openai import AzureOpenAIEmbeddings, OpenAIEmbeddings
|
||||
from langchain_community.embeddings import HuggingFaceHubEmbeddings, OllamaEmbeddings
|
||||
from langchain_community.embeddings import HuggingFaceHubEmbeddings, OllamaEmbeddings, BedrockEmbeddings
|
||||
from langchain_google_genai import GoogleGenerativeAIEmbeddings
|
||||
from ..helpers import models_tokens
|
||||
from ..models import AzureOpenAI, Bedrock, Gemini, Groq, HuggingFace, Ollama, OpenAI, Anthropic
|
||||
from ..models import AzureOpenAI, Bedrock, Gemini, Groq, HuggingFace, Ollama, OpenAI, Anthropic, Claude
|
||||
|
||||
|
||||
class AbstractGraph(ABC):
|
||||
"""
|
||||
Scaffolding class for creating a graph representation and executing it.
|
||||
|
||||
Attributes:
|
||||
prompt (str): The prompt for the graph.
|
||||
source (str): The source of the graph.
|
||||
config (dict): Configuration parameters for the graph.
|
||||
@ -162,7 +162,7 @@ class AbstractGraph(ABC):
|
||||
try:
|
||||
self.model_token = models_tokens["ollama"][llm_params["model"]]
|
||||
except KeyError as exc:
|
||||
raise KeyError("Model not supported") from exc
|
||||
self.model_token = 8192
|
||||
else:
|
||||
self.model_token = 8192
|
||||
except AttributeError:
|
||||
|
||||
@ -110,4 +110,4 @@ class ScriptCreatorGraph(AbstractGraph):
|
||||
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
|
||||
self.final_state, self.execution_info = self.graph.execute(inputs)
|
||||
|
||||
return self.final_state.get("answer", "No answer found.")
|
||||
return self.final_state.get("answer", "No answer found ")
|
||||
|
||||
@ -39,7 +39,8 @@ models_tokens = {
|
||||
"dolphin-mixtral": 32000,
|
||||
"mistral-openorca": 32000,
|
||||
"stablelm-zephyr": 8192,
|
||||
"nomic-embed-text": 8192
|
||||
"nomic-embed-text": 8192,
|
||||
"mxbai-embed-large'": 8192
|
||||
},
|
||||
"groq": {
|
||||
"llama3-8b-8192": 8192,
|
||||
|
||||
@ -12,3 +12,4 @@ from .hugging_face import HuggingFace
|
||||
from .groq import Groq
|
||||
from .bedrock import Bedrock
|
||||
from .anthropic import Anthropic
|
||||
from .claude import Claude
|
||||
|
||||
19
scrapegraphai/models/claude.py
Normal file
19
scrapegraphai/models/claude.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
Claude model
|
||||
"""
|
||||
from langchain_anthropic import ChatAnthropic
|
||||
|
||||
|
||||
class Claude(ChatAnthropic):
|
||||
"""Class for wrapping bedrock module"""
|
||||
|
||||
def __init__(self, llm_config: dict):
|
||||
"""
|
||||
A wrapper for the Claude class that provides default configuration
|
||||
and could be extended with additional methods if needed.
|
||||
|
||||
Args:
|
||||
llm_config (dict): Configuration parameters for the language model.
|
||||
"""
|
||||
# Initialize the superclass (ChatAnthropic) with provided config parameters
|
||||
super().__init__(**llm_config)
|
||||
Loading…
Reference in New Issue
Block a user