Skip to content

Commit 75994fd

Browse files
committed
Fix double hashtag in code comments
1 parent 00613a8 commit 75994fd

149 files changed

Lines changed: 898 additions & 896 deletions

File tree

Some content is hidden

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

docs-website/docs/concepts/components/custom-components.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class DerivedComponent(BaseComponent):
159159
super(DerivedComponent, self).__init__()
160160

161161

162-
## ...
162+
# ...
163163

164164
dc = DerivedComponent() # ok
165165
```

docs-website/docs/concepts/components/supercomponents.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ With this decorator, the `to_dict` and `from_dict` serialization is optional, as
2020
The custom HybridRetriever example SuperComponent below turns your query into embeddings, then runs both a BM25 search and an embedding-based search at the same time. It finally merges those two result sets and returns the combined documents.
2121

2222
```python
23-
## pip install haystack-ai datasets "sentence-transformers>=3.0.0"
23+
# pip install haystack-ai datasets "sentence-transformers>=3.0.0"
2424

2525
from haystack import Document, Pipeline, super_component
2626
from haystack.components.joiners import DocumentJoiner
@@ -145,7 +145,7 @@ pipeline.add_component("llm", OpenAIChatGenerator())
145145
pipeline.connect("retriever.documents", "prompt_builder.documents")
146146
pipeline.connect("prompt_builder.prompt", "llm.messages")
147147

148-
## Create a super component with simplified input/output mapping
148+
# Create a super component with simplified input/output mapping
149149
wrapper = SuperComponent(
150150
pipeline=pipeline,
151151
input_mapping={
@@ -157,7 +157,7 @@ wrapper = SuperComponent(
157157
}
158158
)
159159

160-
## Run the pipeline with simplified interface
160+
# Run the pipeline with simplified interface
161161
result = wrapper.run(query="What is the capital of France?")
162162
print(result)
163163
{'replies': [ChatMessage(_role=<ChatRole.ASSISTANT: 'assistant'>,

docs-website/docs/concepts/data-classes.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ class StreamingChunk:
193193
```python
194194
from haystack.dataclasses import StreamingChunk, ToolCallDelta, ReasoningContent
195195

196-
## Basic text chunk
196+
# Basic text chunk
197197
chunk = StreamingChunk(
198198
content="Hello world",
199199
start=True,
200200
meta={"model": "gpt-5-mini"},
201201
)
202202

203-
## Tool call chunk
203+
# Tool call chunk
204204
tool_chunk = StreamingChunk(
205205
content="",
206206
tool_calls=[
@@ -215,7 +215,7 @@ tool_chunk = StreamingChunk(
215215
finish_reason="tool_calls",
216216
)
217217

218-
## Reasoning chunk
218+
# Reasoning chunk
219219
reasoning_chunk = StreamingChunk(
220220
content="",
221221
reasoning=ReasoningContent(

docs-website/docs/concepts/data-classes/chatmessage.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ You can no longer directly initialize `ChatMessage` using `role`, `content`, and
380380
```python
381381
from haystack.dataclasses import ChatMessage
382382

383-
## LEGACY - DOES NOT WORK IN 2.9.0
383+
# LEGACY - DOES NOT WORK IN 2.9.0
384384
message = ChatMessage(role=ChatRole.USER, content="Hello!")
385385

386-
## Use the class method instead
386+
# Use the class method instead
387387
message = ChatMessage.from_user("Hello!")
388388
```
389389

@@ -405,9 +405,9 @@ from haystack.dataclasses import ChatMessage
405405

406406
message = ChatMessage.from_user("Hello!")
407407

408-
## LEGACY - DOES NOT WORK IN 2.9.0
408+
# LEGACY - DOES NOT WORK IN 2.9.0
409409
print(message.content)
410410

411-
## Use the appropriate property instead
411+
# Use the appropriate property instead
412412
print(message.text)
413413
```

docs-website/docs/concepts/device-management.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To use a single device for inference, use either the `ComponentDevice.from_singl
3737
from haystack.utils import ComponentDevice, Device
3838

3939
device = ComponentDevice.from_single(Device.gpu(id=1))
40-
## Alternatively, use a PyTorch device string
40+
# Alternatively, use a PyTorch device string
4141
device = ComponentDevice.from_str("cuda:1")
4242
generator = HuggingFaceLocalGenerator(model="llama2", device=device)
4343
```
@@ -98,16 +98,16 @@ class MyComponent(Component):
9898
init_params["device"] = ComponentDevice.from_dict(init_params["device"])
9999
return default_from_dict(cls, data)
100100

101-
## Automatically selects a device.
101+
# Automatically selects a device.
102102
c = MyComponent(device=None)
103103

104-
## Uses the first GPU available.
104+
# Uses the first GPU available.
105105
c = MyComponent(device=ComponentDevice.from_str("cuda:0"))
106106

107-
## Uses the CPU.
107+
# Uses the CPU.
108108
c = MyComponent(device=ComponentDevice.from_single(Device.cpu()))
109109

110-
## Allow the component to use multiple devices using a device map.
110+
# Allow the component to use multiple devices using a device map.
111111
c = MyComponent(device=ComponentDevice.from_multiple(DeviceMap({
112112
"layer1": Device.cpu(),
113113
"layer2": Device.gpu(1),

docs-website/docs/concepts/experimental-package.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ c.run([ChatMessage.from_user("What's an experiment? Be brief.")])
4848
Experiments can also override existing Haystack features. For example, you can opt into an experimental type of `Pipeline` by changing the usual import:
4949

5050
```python
51-
## from haystack import Pipeline
51+
# from haystack import Pipeline
5252
from haystack_experimental import Pipeline
5353

5454
pipe = Pipeline()
55-
## ...
55+
# ...
5656
pipe.run(...)
5757
```
5858

docs-website/docs/concepts/jinja-templates.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ template = """
3636
Language: {{ language }}
3737
Question: {{ question }}
3838
"""
39-
## pass both variables when rendering
39+
# pass both variables when rendering
4040
```
4141

4242
It you need to use an f‑string (escape braces):

docs-website/docs/concepts/pipelines/creating-pipelines.mdx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ Add components to the pipeline one by one. The order in which you do this doesn'
5656
```python
5757
query_pipeline.add_component("component_name", component_type)
5858

59-
## Here is an example of how you'd add the components initialized in step 2 above:
59+
# Here is an example of how you'd add the components initialized in step 2 above:
6060
query_pipeline.add_component("text_embedder", text_embedder)
6161
query_pipeline.add_component("retriever", retriever)
6262

63-
## You could also add components without initializing them before:
63+
# You could also add components without initializing them before:
6464
query_pipeline.add_component("text_embedder", SentenceTransformersTextEmbedder())
6565
query_pipeline.add_component(
6666
"retriever",
@@ -77,30 +77,30 @@ To understand what inputs are expected to run your pipeline, use an `.inputs()`
7777
Here's a more visual explanation within the code:
7878

7979
```python
80-
## This is the syntax to connect components. Here you're connecting output1 of component1 to input1 of component2:
80+
# This is the syntax to connect components. Here you're connecting output1 of component1 to input1 of component2:
8181
pipeline.connect("component1.output1", "component2.input1")
8282

83-
## If both components have only one output and input, you can just pass their names:
83+
# If both components have only one output and input, you can just pass their names:
8484
pipeline.connect("component1", "component2")
8585

86-
## If one of the components has only one output but the other has multiple inputs,
87-
## you can pass just the name of the component with a single output, but for the component with
88-
## multiple inputs, you must specify which input you want to connect
86+
# If one of the components has only one output but the other has multiple inputs,
87+
# you can pass just the name of the component with a single output, but for the component with
88+
# multiple inputs, you must specify which input you want to connect
8989

90-
## Here, component1 has only one output, but component2 has multiple inputs:
90+
# Here, component1 has only one output, but component2 has multiple inputs:
9191
pipeline.connect("component1", "component2.input1")
9292

93-
## And here's how it should look like for the semantic document search pipeline we're using as an example:
93+
# And here's how it should look like for the semantic document search pipeline we're using as an example:
9494
pipeline.connect("text_embedder.embedding", "retriever.query_embedding")
95-
## Because the InMemoryEmbeddingRetriever only has one input, this is also correct:
95+
# Because the InMemoryEmbeddingRetriever only has one input, this is also correct:
9696
pipeline.connect("text_embedder.embedding", "retriever")
9797
```
9898

9999
You need to link all the components together, connecting them gradually in pairs. Here's an explicit example for the pipeline we're assembling:
100100

101101
```python
102-
## Imagine this pipeline has four components: text_embedder, retriever, prompt_builder and llm.
103-
## Here's how you would connect them into a pipeline:
102+
# Imagine this pipeline has four components: text_embedder, retriever, prompt_builder and llm.
103+
# Here's how you would connect them into a pipeline:
104104

105105
query_pipeline.connect("text_embedder.embedding", "retriever")
106106
query_pipeline.connect("retriever", "prompt_builder.documents")
@@ -112,13 +112,13 @@ query_pipeline.connect("prompt_builder", "llm")
112112
Wait for the pipeline to validate the components and connections. If everything is OK, you can now run the pipeline. `Pipeline.run()` can be called in two ways, either passing a dictionary of the component names and their inputs, or by directly passing just the inputs. When passed directly, the pipeline resolves inputs to the correct components.
113113

114114
```python
115-
## Here's one way of calling the run() method
115+
# Here's one way of calling the run() method
116116
results = pipeline.run({"component1": {"input1_value": value1, "input2_value": value2}})
117117

118-
## The inputs can also be passed directly without specifying component names
118+
# The inputs can also be passed directly without specifying component names
119119
results = pipeline.run({"input1_value": value1, "input2_value": value2})
120120

121-
## This is how you'd run the semantic document search pipeline we're using as an example:
121+
# This is how you'd run the semantic document search pipeline we're using as an example:
122122
query = "Here comes the query text"
123123
results = query_pipeline.run({"text_embedder": {"text": query}})
124124
```
@@ -130,7 +130,7 @@ If you need to understand what component inputs are expected to run your pipelin
130130
This is how it works:
131131

132132
```python
133-
## A short pipeline example that converts webpages into documents
133+
# A short pipeline example that converts webpages into documents
134134
from haystack import Pipeline
135135
from haystack.document_stores.in_memory import InMemoryDocumentStore
136136
from haystack.components.fetchers import LinkContentFetcher
@@ -150,19 +150,19 @@ pipeline.add_component(instance=writer, name="writer")
150150
pipeline.connect("fetcher.streams", "converter.sources")
151151
pipeline.connect("converter.documents", "writer.documents")
152152

153-
## Requesting a list of required inputs
153+
# Requesting a list of required inputs
154154
pipeline.inputs()
155155

156-
## {'fetcher': {'urls': {'type': typing.List[str], 'is_mandatory': True}},
157-
## 'converter': {'meta': {'type': typing.Union[typing.Dict[str, typing.Any], typing.List[typing.Dict[str, typing.Any]], NoneType],
158-
## 'is_mandatory': False,
159-
## 'default_value': None},
160-
## 'extraction_kwargs': {'type': typing.Optional[typing.Dict[str, typing.Any]],
161-
## 'is_mandatory': False,
162-
## 'default_value': None}},
163-
## 'writer': {'policy': {'type': typing.Optional[haystack.document_stores.types.policy.DuplicatePolicy],
164-
## 'is_mandatory': False,
165-
## 'default_value': None}}}
156+
# {'fetcher': {'urls': {'type': typing.List[str], 'is_mandatory': True}},
157+
# 'converter': {'meta': {'type': typing.Union[typing.Dict[str, typing.Any], typing.List[typing.Dict[str, typing.Any]], NoneType],
158+
# 'is_mandatory': False,
159+
# 'default_value': None},
160+
# 'extraction_kwargs': {'type': typing.Optional[typing.Dict[str, typing.Any]],
161+
# 'is_mandatory': False,
162+
# 'default_value': None}},
163+
# 'writer': {'policy': {'type': typing.Optional[haystack.document_stores.types.policy.DuplicatePolicy],
164+
# 'is_mandatory': False,
165+
# 'default_value': None}}}
166166
```
167167

168168
From the above response, you can see that the `urls` input is mandatory for `LinkContentFetcher`. This is how you would then run this pipeline:

docs-website/docs/concepts/pipelines/debugging-pipelines.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ from haystack.components.generators.chat import OpenAIChatGenerator
3131
from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder
3232
from haystack.dataclasses import ChatMessage
3333

34-
## Documents
34+
# Documents
3535
documents = [
3636
Document(content="Joe lives in Berlin"),
3737
Document(content="Joe is a software engineer"),
3838
]
3939

40-
## Define prompt template
40+
# Define prompt template
4141
prompt_template = [
4242
ChatMessage.from_system("You are a helpful assistant."),
4343
ChatMessage.from_user(
@@ -47,7 +47,7 @@ prompt_template = [
4747
),
4848
]
4949

50-
## Define pipeline
50+
# Define pipeline
5151
p = Pipeline()
5252
p.add_component(
5353
instance=ChatPromptBuilder(
@@ -62,16 +62,16 @@ p.add_component(
6262
)
6363
p.connect("prompt_builder", "llm.messages")
6464

65-
## Define question
65+
# Define question
6666
question = "Where does Joe live?"
6767

68-
## Execute pipeline
68+
# Execute pipeline
6969
result = p.run(
7070
{"prompt_builder": {"documents": documents, "query": question}},
7171
include_outputs_from="prompt_builder",
7272
)
7373

74-
## Print result
74+
# Print result
7575
print(result)
7676
```
7777

docs-website/docs/concepts/pipelines/pipeline-breakpoints.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Create a `Breakpoint` by specifying the component name and the visit count at wh
2525
from haystack.dataclasses.breakpoints import Breakpoint
2626
from haystack.core.errors import BreakpointException
2727

28-
## Create a breakpoint that triggers on the first visit to the "llm" component
28+
# Create a breakpoint that triggers on the first visit to the "llm" component
2929
break_point = Breakpoint(
3030
component_name="llm",
3131
visit_count=0, # 0 = first visit, 1 = second visit, etc.
3232
snapshot_file_path="/path/to/snapshots", # Optional: save snapshot to file
3333
)
3434

35-
## Run pipeline with breakpoint
35+
# Run pipeline with breakpoint
3636
try:
3737
result = pipeline.run(data=input_data, break_point=break_point)
3838
except BreakpointException as e:
@@ -103,10 +103,10 @@ Use the `load_pipeline_snapshot()` to first load the JSON and then pass it to th
103103
```python
104104
from haystack.core.pipeline.breakpoint import load_pipeline_snapshot
105105

106-
## Load the snapshot
106+
# Load the snapshot
107107
snapshot = load_pipeline_snapshot("llm_2025_05_03_11_23_23.json")
108108

109-
## Resume execution from the snapshot
109+
# Resume execution from the snapshot
110110
result = pipeline.run(data={}, pipeline_snapshot=snapshot)
111111
print(result["llm"]["replies"])
112112
```
@@ -123,7 +123,7 @@ A `ChatGenerator` breakpoint is defined as shown below. You need to define a `Br
123123
```python
124124
from haystack.dataclasses.breakpoints import AgentBreakpoint, Breakpoint, ToolBreakpoint
125125

126-
## Break at chat generator (LLM calls)
126+
# Break at chat generator (LLM calls)
127127
chat_bp = Breakpoint(component_name="chat_generator", visit_count=0)
128128
agent_breakpoint = AgentBreakpoint(break_point=chat_bp, agent_name="my_agent")
129129
```
@@ -137,7 +137,7 @@ Then, define an `AgentBreakpoint` passing the `ToolBreakpoint` defined before as
137137
```python
138138
from haystack.dataclasses.breakpoints import AgentBreakpoint, Breakpoint, ToolBreakpoint
139139

140-
## Break at tool invoker (tool calls)
140+
# Break at tool invoker (tool calls)
141141
tool_bp = ToolBreakpoint(
142142
component_name="tool_invoker",
143143
visit_count=0,
@@ -153,11 +153,11 @@ When an Agent breakpoint is triggered, you can resume execution using the sa
153153
```python
154154
from haystack.core.pipeline.breakpoint import load_pipeline_snapshot
155155

156-
## Load the snapshot
156+
# Load the snapshot
157157
snapshot_file = "./agent_debug/agent_chat_generator_2025_07_11_23_23.json"
158158
snapshot = load_pipeline_snapshot(snapshot_file)
159159

160-
## Resume pipeline execution
160+
# Resume pipeline execution
161161
result = pipeline.run(data={}, pipeline_snapshot=snapshot)
162162
print("Pipeline resumed successfully")
163163
print(f"Final result: {result}")

0 commit comments

Comments
 (0)