Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
add api_key as parameter instead of .env file
VinciGit00c02203068e32
diff --git a/README.md b/README.mdindex 8e75eee3..ae281262 100644--- a/README.md+++ b/README.md@@ -16,11 +16,19 @@ The reference page for Scrapegraph-ai is avaible on the official page of pypy: [pip install scrapegraphai```## π Demo+Official streamlit demo:-Try out ScrapeGraphAI in your browser:+[](https://scrapegraphaimockup.streamlit.app/)++Is it possible to try also the colab version[](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)+Try out ScrapeGraphAI in your browser:++[](https://codespaces.new/VinciGit00/Scrapegraph-ai)++## π DocumentationThe documentation for ScrapeGraphAI can be found [here](https://scrapegraph-ai.readthedocs.io/en/latest/).@@ -78,10 +86,13 @@ For more information, please see the [contributing guidelines](https://github.coJoin our Discord server to discuss with us improvements and give us suggestions!-[](https://discord.gg/DujC7HG8)-+[](https://discord.gg/DujC7HG8)++You can also follow all the updates on linkedin!-[](https://www.linkedin.com/company/scrapegraphai/)++[](https://www.linkedin.com/company/scrapegraphai/)+## Contributors[](https://github.com/VinciGit00/Scrapegraph-ai/graphs/contributors)diff --git a/scrapegraphai/evaluetor/trulens_evaluetor.py b/scrapegraphai/evaluetor/trulens_evaluetor.pyindex 88b1756e..17e3ec5e 100644--- a/scrapegraphai/evaluetor/trulens_evaluetor.py+++ b/scrapegraphai/evaluetor/trulens_evaluetor.py@@ -1,7 +1,8 @@-import os-from scrapegraphai.graphs import SmartScraperGraph-from openai import OpenAI+"""Module for making the RAG"""from trulens_eval import Feedback, OpenAI as fOpenAI, Tru, Provider, Select, TruBasicApp+from openai import OpenAI+from scrapegraphai.graphs import SmartScraperGraph+class TrulensEvaluator:"""@@ -16,20 +17,27 @@ class TrulensEvaluator:llm_standalone: Standalone function for Trulens evaluation."""- def __init__(self):+ def __init__(self, key: str):+ """+ Initialization of the class+ Arguments:+ - key (str): openai key+ """standalone = StandAlone()f_custom_function = Feedback(standalone.json_complaint).on(my_text_field=Select.RecordOutput)- os.environ["OPENAI_API_KEY"] = os.environ["OPENAI_APIKEY"]- client = OpenAI()+ client = OpenAI(api_key=key)tru = Tru()tru.reset_database()fopenai = fOpenAI()f_relevance = Feedback(self.fopenai.relevance).on_input_output()- tru_llm_standalone_recorder = TruBasicApp(self.llm_standalone, app_id="smart_scraper_evaluator", feedbacks=[self.f_relevance, self.f_custom_function])+ tru_llm_standalone_recorder = TruBasicApp(self.llm_standalone,+ app_id="smart_scraper_evaluator",+ feedbacks=[self.f_relevance,+ self.f_custom_function])- def evaluate(self, graph_params : list[tuple[str, str, dict]]):+ def evaluate(self, graph_params: list[tuple[str, str, dict]]):"""Evaluates Trulens using SmartScraperGraph and starts the dashboard.@@ -59,13 +67,18 @@ class TrulensEvaluator:print(f"Prompt: {prompt}")return str(response)-"""-Class for standalone Trulens evaluation. Personalise-"""+class StandAlone(Provider):+ """+ Class for standalone Trulens evaluation.+ """+def json_complaint(self, my_text_field: str) -> float:+ """+ Args:+ - my_text_field (str): textfield+ """if '{' in my_text_field and '}' in my_text_field and ':' in my_text_field:return 1.0else:return 0.0-