Skip to content

Commit 9b9a9f2

Browse files
committed
handling the agent model
1 parent adf89e5 commit 9b9a9f2

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

examples/benchmarks/SmartScraper/benchmark_docker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Basic example of scraping pipeline using SmartScraper from text
33
"""
44

5-
import os
65
from scrapegraphai.graphs import SmartScraperGraph
76
from scrapegraphai.utils import prettify_exec_info
87

scrapegraphai/helpers/robots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
robots_dictionary = {
66
"gpt-3.5-turbo": ["GPTBot", "ChatGPT-user"],
77
"gpt-4-turbo": ["GPTBot", "ChatGPT-user"],
8-
"claude": "Claude-Web",
8+
"claude": ["Claude-Web", "ClaudeBot"],
99
"perplexity": "PerplexityBot",
1010
"cohere": "cohere-ai",
1111
"anthropic": "anthropic-ai"

scrapegraphai/nodes/rag_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from langchain_community.document_transformers import EmbeddingsRedundantFilter
1010
from langchain_community.embeddings import HuggingFaceHubEmbeddings
1111
from langchain_community.vectorstores import FAISS
12+
from langchain_community.embeddings import OllamaEmbeddings
1213
from langchain_openai import OpenAIEmbeddings, AzureOpenAIEmbeddings
1314
from ..models import OpenAI, Ollama, AzureOpenAI, HuggingFace
14-
from langchain_community.embeddings import OllamaEmbeddings
1515
from .base_node import BaseNode
1616

1717

@@ -97,7 +97,7 @@ def execute(self, state):
9797
# remove streaming and temperature
9898
params.pop("streaming", None)
9999
params.pop("temperature", None)
100-
100+
101101
embeddings = OllamaEmbeddings(**params)
102102
elif isinstance(embedding_model, HuggingFace):
103103
embeddings = HuggingFaceHubEmbeddings(model=embedding_model.model)

scrapegraphai/nodes/robots_node.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ def execute(self, state):
102102

103103
document = loader.load()
104104

105-
# TODO: look at the agent
106-
agent = "TODO"
107-
# mandare la richiesta
108-
# if errore -> manda l'eccezione
109-
# poi faccio un return
105+
model = self.llm_model["model"]
106+
107+
if "ollama" in model:
108+
model = model.split("/", maxsplit=1)[-1]
109+
110+
try:
111+
agent = robots_dictionary[model]
112+
113+
except KeyError:
114+
agent = model
115+
110116
prompt = PromptTemplate(
111117
template=template,
112118
partial_variables={"context": document,

0 commit comments

Comments
 (0)