Repository: deepset-ai/haystack

Issue:
Websearch components cannot connect to `LinkContentFetcher`
**To Reproduce**
[Websearch pipeline from our docs](https://docs.haystack.deepset.ai/v2.0/docs/serperdevwebsearch)
```python
from haystack import Pipeline
from haystack.components.builders.prompt_builder import PromptBuilder
from haystack.components.fetchers import LinkContentFetcher
from haystack.components.converters import HTMLToDocument
from haystack.components.generators import OpenAIGenerator
from haystack.components.websearch import SerperDevWebSearch

web_search = SerperDevWebSearch(top_k=2)
link_content = LinkContentFetcher()
html_converter = HTMLToDocument()

template = """Given the information below: \n
            {% for document in documents %}
                {{ document.content }}
            {% endfor %}
            Answer question: {{ query }}. \n Answer:"""

prompt_builder = PromptBuilder(template=template)
llm = OpenAIGenerator(model="gpt-3.5-turbo")

pipe = Pipeline()
pipe.add_component("search", web_search)
pipe.add_component("fetcher", link_content)
pipe.add_component("converter", html_converter)
pipe.add_component("prompt_builder", prompt_builder)
pipe.add_component("llm", llm)

pipe.connect("search.links", "fetcher.urls")
pipe.connect("fetcher.streams", "converter.sources")
pipe.connect("converter.documents", "prompt_builder.documents")
pipe.connect("prompt_builder.prompt", "llm.prompt")
```
**Error message**

>   File "try.py", line 29, in <module>
>     pipe.connect("search.links", "fetcher.urls")
>   File "/home/anakin87/apps/haystack/haystack/core/pipeline/pipeline.py", line 398, in connect
>     raise PipelineConnectError(msg)
> haystack.core.errors.PipelineConnectError: Cannot connect 'search.links' with 'fetcher.urls': their declared input and output types do not match.
> 'search':
>  - links: Union[List[Document], List[str]]
> 'fetcher':
>  - urls: List[str] (available)


**System:**
 - Haystack version (commit or version number): https://github.com/deepset-ai/haystack/commit/408be735e5abea51793a0426bfb899d3c9579e52



Discussion:

Resolving patch:
diff --git a/haystack/components/websearch/searchapi.py b/haystack/components/websearch/searchapi.py
--- a/haystack/components/websearch/searchapi.py
+++ b/haystack/components/websearch/searchapi.py
@@ -88,7 +88,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SearchApiWebSearch":
         deserialize_secrets_inplace(data["init_parameters"], keys=["api_key"])
         return default_from_dict(cls, data)
 
-    @component.output_types(documents=List[Document], links=Union[List[Document], List[str]])
+    @component.output_types(documents=List[Document], links=List[str])
     def run(self, query: str) -> Dict[str, Union[List[Document], List[str]]]:
         """
         Uses [SearchApi](https://www.searchapi.io/) to search the web.
diff --git a/haystack/components/websearch/serper_dev.py b/haystack/components/websearch/serper_dev.py
--- a/haystack/components/websearch/serper_dev.py
+++ b/haystack/components/websearch/serper_dev.py
@@ -85,7 +85,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SerperDevWebSearch":
         deserialize_secrets_inplace(data["init_parameters"], keys=["api_key"])
         return default_from_dict(cls, data)
 
-    @component.output_types(documents=List[Document], links=Union[List[Document], List[str]])
+    @component.output_types(documents=List[Document], links=List[str])
     def run(self, query: str) -> Dict[str, Union[List[Document], List[str]]]:
         """
         Use [Serper](https://serper.dev/) to search the web.


Test patch: