Skip to content

Commit adbf450

Browse files
authored
docs: Add YAML representation of RAG pipeline for SerperDevWebSearch (#11121)
1 parent 7b141e4 commit adbf450

2 files changed

Lines changed: 182 additions & 0 deletions

File tree

docs-website/docs/pipeline-components/websearch/serperdevwebsearch.mdx

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,97 @@ query = "What is the most famous landmark in Berlin?"
104104
pipe.run(data={"search": {"query": query}, "prompt_builder": {"query": query}})
105105
```
106106

107+
### In YAML
108+
This is the YAML representation of the RAG pipeline shown above. It searches the web, fetches the resulting pages, converts them to text, builds a prompt with the content, and generates an answer using a chat model.
109+
110+
```yaml
111+
components:
112+
converter:
113+
init_parameters:
114+
extraction_kwargs: {}
115+
store_full_path: false
116+
type: haystack.components.converters.html.HTMLToDocument
117+
fetcher:
118+
init_parameters:
119+
client_kwargs:
120+
follow_redirects: true
121+
timeout: 3
122+
http2: false
123+
raise_on_failure: true
124+
request_headers: {}
125+
retry_attempts: 2
126+
timeout: 3
127+
user_agents:
128+
- haystack/LinkContentFetcher/2.27.0rc0
129+
type: haystack.components.fetchers.link_content.LinkContentFetcher
130+
llm:
131+
init_parameters:
132+
api_base_url: null
133+
api_key:
134+
env_vars:
135+
- OPENAI_API_KEY
136+
strict: true
137+
type: env_var
138+
generation_kwargs: {}
139+
http_client_kwargs: null
140+
max_retries: null
141+
model: gpt-4o-mini
142+
organization: null
143+
streaming_callback: null
144+
timeout: null
145+
tools: null
146+
tools_strict: false
147+
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
148+
prompt_builder:
149+
init_parameters:
150+
required_variables:
151+
- documents
152+
- query
153+
template:
154+
- content:
155+
- text: You are a helpful assistant.
156+
meta: {}
157+
name: null
158+
role: system
159+
- content:
160+
- text: 'Given the information below:
161+
162+
{% for document in documents %}{{ document.content }}{% endfor %}
163+
164+
Answer question: {{ query }}.
165+
166+
Answer:'
167+
meta: {}
168+
name: null
169+
role: user
170+
variables: null
171+
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
172+
search:
173+
init_parameters:
174+
allowed_domains: null
175+
api_key:
176+
env_vars:
177+
- SERPERDEV_API_KEY
178+
strict: true
179+
type: env_var
180+
exclude_subdomains: false
181+
search_params: {}
182+
top_k: 2
183+
type: haystack.components.websearch.serper_dev.SerperDevWebSearch
184+
connection_type_validation: true
185+
connections:
186+
- receiver: fetcher.urls
187+
sender: search.links
188+
- receiver: converter.sources
189+
sender: fetcher.streams
190+
- receiver: prompt_builder.documents
191+
sender: converter.documents
192+
- receiver: llm.messages
193+
sender: prompt_builder.prompt
194+
max_runs_per_component: 100
195+
metadata: {}
196+
```
197+
107198
## Additional References
108199
109200
:notebook: Tutorial: [Building Fallbacks to Websearch with Conditional Routing](https://haystack.deepset.ai/tutorials/36_building_fallbacks_with_conditional_routing)

docs-website/versioned_docs/version-2.27/pipeline-components/websearch/serperdevwebsearch.mdx

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,97 @@ query = "What is the most famous landmark in Berlin?"
104104
pipe.run(data={"search": {"query": query}, "prompt_builder": {"query": query}})
105105
```
106106

107+
### In YAML
108+
This is the YAML representation of the RAG pipeline shown above. It searches the web, fetches the resulting pages, converts them to text, builds a prompt with the content, and generates an answer using a chat model.
109+
110+
```yaml
111+
components:
112+
converter:
113+
init_parameters:
114+
extraction_kwargs: {}
115+
store_full_path: false
116+
type: haystack.components.converters.html.HTMLToDocument
117+
fetcher:
118+
init_parameters:
119+
client_kwargs:
120+
follow_redirects: true
121+
timeout: 3
122+
http2: false
123+
raise_on_failure: true
124+
request_headers: {}
125+
retry_attempts: 2
126+
timeout: 3
127+
user_agents:
128+
- haystack/LinkContentFetcher/2.27.0rc0
129+
type: haystack.components.fetchers.link_content.LinkContentFetcher
130+
llm:
131+
init_parameters:
132+
api_base_url: null
133+
api_key:
134+
env_vars:
135+
- OPENAI_API_KEY
136+
strict: true
137+
type: env_var
138+
generation_kwargs: {}
139+
http_client_kwargs: null
140+
max_retries: null
141+
model: gpt-4o-mini
142+
organization: null
143+
streaming_callback: null
144+
timeout: null
145+
tools: null
146+
tools_strict: false
147+
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
148+
prompt_builder:
149+
init_parameters:
150+
required_variables:
151+
- documents
152+
- query
153+
template:
154+
- content:
155+
- text: You are a helpful assistant.
156+
meta: {}
157+
name: null
158+
role: system
159+
- content:
160+
- text: 'Given the information below:
161+
162+
{% for document in documents %}{{ document.content }}{% endfor %}
163+
164+
Answer question: {{ query }}.
165+
166+
Answer:'
167+
meta: {}
168+
name: null
169+
role: user
170+
variables: null
171+
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
172+
search:
173+
init_parameters:
174+
allowed_domains: null
175+
api_key:
176+
env_vars:
177+
- SERPERDEV_API_KEY
178+
strict: true
179+
type: env_var
180+
exclude_subdomains: false
181+
search_params: {}
182+
top_k: 2
183+
type: haystack.components.websearch.serper_dev.SerperDevWebSearch
184+
connection_type_validation: true
185+
connections:
186+
- receiver: fetcher.urls
187+
sender: search.links
188+
- receiver: converter.sources
189+
sender: fetcher.streams
190+
- receiver: prompt_builder.documents
191+
sender: converter.documents
192+
- receiver: llm.messages
193+
sender: prompt_builder.prompt
194+
max_runs_per_component: 100
195+
metadata: {}
196+
```
197+
107198
## Additional References
108199
109200
:notebook: Tutorial: [Building Fallbacks to Websearch with Conditional Routing](https://haystack.deepset.ai/tutorials/36_building_fallbacks_with_conditional_routing)

0 commit comments

Comments
 (0)