|
44 | 44 | "source": [ |
45 | 45 | "%%bash\n", |
46 | 46 | "\n", |
47 | | - "pip install haystack-ai docstring-parser trafilatura" |
| 47 | + "pip install haystack-ai serperdev-haystack docstring-parser trafilatura" |
48 | 48 | ] |
49 | 49 | }, |
50 | 50 | { |
|
96 | 96 | "source": [ |
97 | 97 | "from haystack.components.agents import Agent\n", |
98 | 98 | "from haystack.components.generators.chat import OpenAIChatGenerator\n", |
99 | | - "from haystack.components.websearch import SerperDevWebSearch\n", |
| 99 | + "from haystack_integrations.components.websearch.serperdev import SerperDevWebSearch\n", |
100 | 100 | "from haystack.dataclasses import ChatMessage\n", |
101 | 101 | "from haystack.tools.component_tool import ComponentTool\n", |
102 | 102 | "\n", |
|
198 | 198 | "from haystack.components.converters.html import HTMLToDocument\n", |
199 | 199 | "from haystack.components.converters.output_adapter import OutputAdapter\n", |
200 | 200 | "from haystack.components.fetchers.link_content import LinkContentFetcher\n", |
201 | | - "from haystack.components.websearch.serper_dev import SerperDevWebSearch\n", |
| 201 | + "from haystack_integrations.components.websearch.serperdev import SerperDevWebSearch\n", |
202 | 202 | "from haystack.dataclasses import ChatMessage\n", |
203 | 203 | "from haystack.core.pipeline import Pipeline\n", |
204 | 204 | "\n", |
|
242 | 242 | "id": "yxaN3KBo65pv" |
243 | 243 | }, |
244 | 244 | "outputs": [], |
245 | | - "source": "from haystack.tools import PipelineTool\nfrom haystack.components.agents import Agent\nfrom haystack.components.generators.chat import OpenAIChatGenerator\n\nsearch_tool = PipelineTool(\n name=\"search\",\n description=\"Use this tool to search for information on the internet.\",\n pipeline=search_pipeline,\n input_mapping={\"query\": [\"search.query\"]},\n output_mapping={\"output_adapter.output\": \"search_result\"},\n outputs_to_string={\"source\": \"search_result\"},\n)\n\nagent = Agent(\n chat_generator=OpenAIChatGenerator(model=\"gpt-4o-mini\"),\n tools=[search_tool],\n system_prompt=\"\"\"\n You are a deep research assistant.\n You create comprehensive research reports to answer the user's questions.\n You use the 'search'-tool to answer any questions.\n You perform multiple searches until you have the information you need to answer the question.\n Make sure you research different aspects of the question.\n Use markdown to format your response.\n When you use information from the websearch results, cite your sources using markdown links.\n It is important that you cite accurately.\n \"\"\",\n exit_conditions=[\"text\"],\n max_agent_steps=20,\n)" }, |
| 245 | + "source": "from haystack.tools import PipelineTool\nfrom haystack.components.agents import Agent\nfrom haystack.components.generators.chat import OpenAIChatGenerator\n\nsearch_tool = PipelineTool(\n name=\"search\",\n description=\"Use this tool to search for information on the internet.\",\n pipeline=search_pipeline,\n input_mapping={\"query\": [\"search.query\"]},\n output_mapping={\"output_adapter.output\": \"search_result\"},\n outputs_to_string={\"source\": \"search_result\"},\n)\n\nagent = Agent(\n chat_generator=OpenAIChatGenerator(model=\"gpt-4o-mini\"),\n tools=[search_tool],\n system_prompt=\"\"\"\n You are a deep research assistant.\n You create comprehensive research reports to answer the user's questions.\n You use the 'search'-tool to answer any questions.\n You perform multiple searches until you have the information you need to answer the question.\n Make sure you research different aspects of the question.\n Use markdown to format your response.\n When you use information from the websearch results, cite your sources using markdown links.\n It is important that you cite accurately.\n \"\"\",\n exit_conditions=[\"text\"],\n max_agent_steps=20,\n)" |
| 246 | + }, |
246 | 247 | { |
247 | 248 | "cell_type": "markdown", |
248 | 249 | "metadata": { |
|
0 commit comments