diff --git a/haystack/components/builders/chat_prompt_builder.py b/haystack/components/builders/chat_prompt_builder.py index 07aabe3c5..68f9a89c8 100644 --- a/haystack/components/builders/chat_prompt_builder.py +++ b/haystack/components/builders/chat_prompt_builder.py @@ -89,7 +89,7 @@ class ChatPromptBuilder: print(res) >> {'llm': {'replies': [ChatMessage(content="Here is the weather forecast for Berlin in the next 5 - days:\n\nDay 1: Mostly cloudy with a high of 22°C (72°F) and...so it's always a good idea to check for updates + days:\\n\\nDay 1: Mostly cloudy with a high of 22°C (72°F) and...so it's always a good idea to check for updates closer to your visit.", role=, name=None, meta={'model': 'gpt-3.5-turbo-0613', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 37, 'completion_tokens': 201, 'total_tokens': 238}})]}} diff --git a/haystack/components/embedders/hugging_face_api_document_embedder.py b/haystack/components/embedders/hugging_face_api_document_embedder.py index c3be9c653..deeaf515e 100644 --- a/haystack/components/embedders/hugging_face_api_document_embedder.py +++ b/haystack/components/embedders/hugging_face_api_document_embedder.py @@ -26,7 +26,7 @@ class HuggingFaceAPIDocumentEmbedder: Embeds documents using Hugging Face APIs. Use it with the following Hugging Face APIs: - - [Free Serverless Inference API]((https://huggingface.co/inference-api) + - [Free Serverless Inference API](https://huggingface.co/inference-api) - [Paid Inference Endpoints](https://huggingface.co/inference-endpoints) - [Self-hosted Text Embeddings Inference](https://github.com/huggingface/text-embeddings-inference) diff --git a/haystack/components/embedders/hugging_face_api_text_embedder.py b/haystack/components/embedders/hugging_face_api_text_embedder.py index c9648404b..747183972 100644 --- a/haystack/components/embedders/hugging_face_api_text_embedder.py +++ b/haystack/components/embedders/hugging_face_api_text_embedder.py @@ -23,7 +23,7 @@ class HuggingFaceAPITextEmbedder: Embeds strings using Hugging Face APIs. Use it with the following Hugging Face APIs: - - [Free Serverless Inference API]((https://huggingface.co/inference-api) + - [Free Serverless Inference API](https://huggingface.co/inference-api) - [Paid Inference Endpoints](https://huggingface.co/inference-endpoints) - [Self-hosted Text Embeddings Inference](https://github.com/huggingface/text-embeddings-inference) diff --git a/haystack/components/preprocessors/document_splitter.py b/haystack/components/preprocessors/document_splitter.py index 4732f316d..c0c39ea82 100644 --- a/haystack/components/preprocessors/document_splitter.py +++ b/haystack/components/preprocessors/document_splitter.py @@ -20,16 +20,16 @@ class DocumentSplitter: and prevents exceeding language model context limits. The DocumentSplitter is compatible with the following DocumentStores: - - (Astra)[https://docs.haystack.deepset.ai/docs/astradocumentstore] - - (Chroma)[https://docs.haystack.deepset.ai/docs/chromadocumentstore] limited support, overlapping information is + - [Astra](https://docs.haystack.deepset.ai/docs/astradocumentstore) + - [Chroma](https://docs.haystack.deepset.ai/docs/chromadocumentstore) limited support, overlapping information is not stored - - (Elasticsearch)[https://docs.haystack.deepset.ai/docs/elasticsearch-document-store] - - (OpenSearch)[https://docs.haystack.deepset.ai/docs/opensearch-document-store] - - (Pgvector)[https://docs.haystack.deepset.ai/docs/pgvectordocumentstore] - - (Pinecone)[https://docs.haystack.deepset.ai/docs/pinecone-document-store] limited support, overlapping + - [Elasticsearch](https://docs.haystack.deepset.ai/docs/elasticsearch-document-store) + - [OpenSearch](https://docs.haystack.deepset.ai/docs/opensearch-document-store) + - [Pgvector](https://docs.haystack.deepset.ai/docs/pgvectordocumentstore) + - [Pinecone](https://docs.haystack.deepset.ai/docs/pinecone-document-store) limited support, overlapping information is not stored - - (Qdrant)[https://docs.haystack.deepset.ai/docs/qdrant-document-store] - - (Weaviate)[https://docs.haystack.deepset.ai/docs/weaviatedocumentstore] + - [Qdrant](https://docs.haystack.deepset.ai/docs/qdrant-document-store) + - [Weaviate](https://docs.haystack.deepset.ai/docs/weaviatedocumentstore) ### Usage example diff --git a/haystack/components/rankers/meta_field.py b/haystack/components/rankers/meta_field.py index 6a45c04c1..3b28742a0 100644 --- a/haystack/components/rankers/meta_field.py +++ b/haystack/components/rankers/meta_field.py @@ -20,7 +20,8 @@ class MetaFieldRanker: The ranking can be performed in descending order or ascending order. Usage example: - ``` + + ```python from haystack import Document from haystack.components.rankers import MetaFieldRanker @@ -34,6 +35,7 @@ class MetaFieldRanker: output = ranker.run(documents=docs) docs = output["documents"] assert docs[0].content == "Barcelona" + ``` """ def __init__( @@ -69,11 +71,11 @@ class MetaFieldRanker: :param missing_meta: What to do with documents that are missing the sorting metadata field. Possible values are: - - 'drop' will drop the documents entirely. - - 'top' will place the documents at the top of the metadata-sorted list - (regardless of 'ascending' or 'descending'). - - 'bottom' will place the documents at the bottom of metadata-sorted list - (regardless of 'ascending' or 'descending'). + - 'drop' will drop the documents entirely. + - 'top' will place the documents at the top of the metadata-sorted list + (regardless of 'ascending' or 'descending'). + - 'bottom' will place the documents at the bottom of metadata-sorted list + (regardless of 'ascending' or 'descending'). :param meta_value_type: Parse the meta value into the data type specified before sorting. This will only work if all meta values stored under `meta_field` in the provided documents are strings. diff --git a/haystack/components/retrievers/sentence_window_retriever.py b/haystack/components/retrievers/sentence_window_retriever.py index 7b7a7d859..1f4eab5ec 100644 --- a/haystack/components/retrievers/sentence_window_retriever.py +++ b/haystack/components/retrievers/sentence_window_retriever.py @@ -25,12 +25,12 @@ class SentenceWindowRetriever: SentenceWindowRetriever to get the surrounding documents for context. The SentenceWindowRetriever is compatible with the following DocumentStores: - - (Astra)[https://docs.haystack.deepset.ai/docs/astradocumentstore] - - (Elasticsearch)[https://docs.haystack.deepset.ai/docs/elasticsearch-document-store] - - (OpenSearch)[https://docs.haystack.deepset.ai/docs/opensearch-document-store] - - (Pgvector)[https://docs.haystack.deepset.ai/docs/pgvectordocumentstore] - - (Pinecone)[https://docs.haystack.deepset.ai/docs/pinecone-document-store] - - (Qdrant)[https://docs.haystack.deepset.ai/docs/qdrant-document-store] + - [Astra](https://docs.haystack.deepset.ai/docs/astradocumentstore) + - [Elasticsearch](https://docs.haystack.deepset.ai/docs/elasticsearch-document-store) + - [OpenSearch](https://docs.haystack.deepset.ai/docs/opensearch-document-store) + - [Pgvector](https://docs.haystack.deepset.ai/docs/pgvectordocumentstore) + - [Pinecone](https://docs.haystack.deepset.ai/docs/pinecone-document-store) + - [Qdrant](https://docs.haystack.deepset.ai/docs/qdrant-document-store) ### Usage example diff --git a/haystack/components/routers/transformers_text_router.py b/haystack/components/routers/transformers_text_router.py index e289c2521..9465f61de 100644 --- a/haystack/components/routers/transformers_text_router.py +++ b/haystack/components/routers/transformers_text_router.py @@ -42,11 +42,11 @@ class TransformersTextRouter: name="text_router" ) p.add_component( - instance=PromptBuilder(template="Answer the question: {{query}}\nAnswer:"), + instance=PromptBuilder(template="Answer the question: {{query}}\\nAnswer:"), name="english_prompt_builder" ) p.add_component( - instance=PromptBuilder(template="Beantworte die Frage: {{query}}\nAntwort:"), + instance=PromptBuilder(template="Beantworte die Frage: {{query}}\\nAntwort:"), name="german_prompt_builder" )