Skip to content

Commit e8103d7

Browse files
add new implementation files
1 parent af11a8d commit e8103d7

File tree

65 files changed

+190
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+190
-162
lines changed

Examples/anthropic_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
"prompt": "How to create a script in Scrapegraphai for scraping a specific website given a prompt and searching on the internet using anthropic as a provider and given a schema?",
16-
"answer": "\"\"\"\nExample of Search Graph\n\"\"\"\n\nimport os\nfrom dotenv import load_dotenv\nload_dotenv()\n\nfrom scrapegraphai.graphs import SearchGraph\nfrom scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info\n\nfrom pydantic import BaseModel, Field\nfrom typing import List\n\n# ************************************************\n# Define the output schema for the graph\n# ************************************************\n\nclass Dish(BaseModel):\n name: str = Field(description=\"The name of the dish\")\n description: str = Field(description=\"The description of the dish\")\n\nclass Dishes(BaseModel):\n dishes: List[Dish]\n\n# ************************************************\n# Define the configuration for the graph\n# ************************************************\ngraph_config = {\n \"llm\": {\n \"api_key\": os.getenv(\"ANTHROPIC_API_KEY\"),\n \"model\": \"claude-3-haiku-20240307\",\n \"max_tokens\": 4000},\n}\n\n# ************************************************\n# Create the SearchGraph instance and run it\n# ************************************************\n\nsearch_graph = SearchGraph(\n prompt=\"List me Chioggia's famous dishes\",\n config=graph_config,\n schema=Dishes\n)\n\nresult = search_graph.run()\nprint(result)\n\n# ************************************************\n# Get graph execution info\n# ************************************************\n\ngraph_exec_info = search_graph.get_execution_info()\nprint(prettify_exec_info(graph_exec_info))\n\n# Save to json and csv\nconvert_to_csv(result, \"result\")\nconvert_to_json(result, \"result\")\n"
16+
"answer": "\"\"\"\nExample of Search Graph\n\"\"\"\n\nimport os\nfrom dotenv import load_dotenv\nload_dotenv()\n\nfrom scrapegraphai.graphs import SearchGraph\n\nfrom pydantic import BaseModel, Field\nfrom typing import List\n\n# ************************************************\n# Define the output schema for the graph\n# ************************************************\n\nclass Dish(BaseModel):\n name: str = Field(description=\"The name of the dish\")\n description: str = Field(description=\"The description of the dish\")\n\nclass Dishes(BaseModel):\n dishes: List[Dish]\n\n# ************************************************\n# Define the configuration for the graph\n# ************************************************\ngraph_config = {\n \"llm\": {\n \"api_key\": os.getenv(\"ANTHROPIC_API_KEY\"),\n \"model\": \"claude-3-haiku-20240307\",\n \"max_tokens\": 4000},\n}\n\n# ************************************************\n# Create the SearchGraph instance and run it\n# ************************************************\n\nsearch_graph = SearchGraph(\n prompt=\"List me Chioggia's famous dishes\",\n config=graph_config,\n schema=Dishes\n)\n\nresult = search_graph.run()\nprint(result)\n"
1717
},
1818
{
1919
"prompt": "How to create a script in Scrapegraphai for scraping an XML given a prompt using haiku (anthropic) as a provider?",

Examples/azure_config.json

+13-14
Large diffs are not rendered by default.

Examples/bedrock_config.json

+14-14
Large diffs are not rendered by default.

Examples/deepseek_config.json

+14-15
Large diffs are not rendered by default.

Examples/ernie_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"prompt": "How to create a script in Scrapegraphai for scraping a specific website given a prompt and searching on internet using ernie as a provider?",
12-
"answer": "\"\"\"\nExample of Search Graph\n\"\"\"\n\nimport os\nfrom dotenv import load_dotenv\nfrom scrapegraphai.graphs import SearchGraph\nfrom scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info\nload_dotenv()\n\n# ************************************************\n# Define the configuration for the graph\n# ************************************************\n\nopenai_key = os.getenv(\"OPENAI_APIKEY\")\n\ngraph_config = {\n \"llm\": {\n \"api_key\": openai_key,\n \"model\": \"gpt-3.5-turbo\",\n },\n \"max_results\": 2,\n \"verbose\": True,\n}\n\n# ************************************************\n# Create the SearchGraph instance and run it\n# ************************************************\n\nsearch_graph = SearchGraph(\n prompt=\"List me Chioggia's famous dishes\",\n config=graph_config\n)\n\nresult = search_graph.run()\nprint(result)\n\n# ************************************************\n# Get graph execution info\n# ************************************************\n\ngraph_exec_info = search_graph.get_execution_info()\nprint(prettify_exec_info(graph_exec_info))\n\n# Save to json and csv\nconvert_to_csv(result, \"result\")\nconvert_to_json(result, \"result\")\n"
12+
"answer": "\"\"\"\nExample of Search Graph\n\"\"\"\n\nimport os\nfrom dotenv import load_dotenv\nfrom scrapegraphai.graphs import SearchGraph\n\nload_dotenv()\n\n# ************************************************\n# Define the configuration for the graph\n# ************************************************\n\ngraph_config = {\n \"llm\": {\n \"model\": \"ernie-bot-turbo\",\n \"ernie_client_id\": \"<ernie_client_id>\",\n \"ernie_client_secret\": \"<ernie_client_secret>\",\n \"temperature\": 0.1\n },\n \"embeddings\": {\n \"model\": \"ollama/nomic-embed-text\",\n \"temperature\": 0,\n \"base_url\": \"http://localhost:11434\"},\n \"library\": \"beautifulsoup\"\n}\n\n# ************************************************\n# Create the SearchGraph instance and run it\n# ************************************************\n\nsearch_graph = SearchGraph(\n prompt=\"List me Chioggia's famous dishes\",\n config=graph_config\n)\n\nresult = search_graph.run()\nprint(result)\n"
1313
},
1414
{
1515
"prompt": "How to create a script in Scrapegraphai for scraping a specific website given a prompt and searching on the internet using ernie as a provider and given a schema?"

0 commit comments

Comments
 (0)