Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
add private class and tests
VinciGit0087616018b6fb
diff --git a/class_creator.py b/class_creator.pyindex 68ff8a93..3933c306 100644--- a/class_creator.py+++ b/class_creator.py@@ -1,7 +1,7 @@base_script = '''from langchain_core.pydantic_v1 import BaseModel, Field-class Response(BaseModel):+class _Response(BaseModel):'''# This function creates a class at runtime using the values from the list.diff --git a/pydantic_class.py b/pydantic_class.pyindex 459f837f..4599c765 100644--- a/pydantic_class.py+++ b/pydantic_class.py@@ -1,4 +1,4 @@from langchain_core.pydantic_v1 import BaseModel, Field-class Response(BaseModel):+class _Response(BaseModel):title_swebsite: str = Field(description='Title of the items')diff --git a/tests/test_amaz_scraper.py b/tests/test_amaz_scraper.pynew file mode 100644index 00000000..fb4c7732--- /dev/null+++ b/tests/test_amaz_scraper.py@@ -0,0 +1,23 @@+import pytest+from AmazScraper.pydantic_class import Response+from AmazScraper.class_creator import create_class+from langchain_openai import ChatOpenAI++def generator():+ values = [+ {"title": "title_swebsite", "type": "str", "description": "Title of the items"},+ ]+ create_class(values)+ return ChatOpenAI(values)++def test_generator_invocation(generator):+ query_info = "Your test query here"+ result = generator.invocation(query_info)+ assert result is not None++def test_response_model():+ # Test the Response Pydantic model+ response_data = {"title_swebsite": "Test Title"}+ response = Response(**response_data)+ assert response.title_swebsite == "Test Title"\ No newline at end of file