From 2025bb75a0c112e503ca6b62236c3ebb5680693b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bilge=20Y=C3=BCcel?= Date: Fri, 19 Jan 2024 18:26:21 +0300 Subject: [PATCH] Adress inmemory import path changes after beta5 (#138) --- integrations/assemblyai.md | 6 +++--- integrations/cohere.md | 4 ++-- integrations/gradient.md | 4 ++-- integrations/huggingface.md | 12 ++++++------ integrations/instructor-embedder.md | 12 ++++++------ integrations/jina.md | 2 +- integrations/lmformatenforcer.md | 2 +- integrations/notion-extractor.md | 2 +- integrations/ollama.md | 2 +- integrations/openai.md | 8 ++++---- integrations/unstructured-file-converter.md | 6 +++--- integrations/voyage.md | 4 ++-- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/integrations/assemblyai.md b/integrations/assemblyai.md index c2254af8..382f575d 100644 --- a/integrations/assemblyai.md +++ b/integrations/assemblyai.md @@ -64,7 +64,7 @@ from haystack.components.writers import DocumentWriter from haystack.components.preprocessors import DocumentSplitter from haystack.components.embedders import SentenceTransformersDocumentEmbedder from haystack.pipeline import Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from assemblyai_haystack.transcriber import AssemblyAITranscriber document_store = InMemoryDocumentStore() @@ -117,7 +117,7 @@ The example below illustrates a generative QA pipeline that seamlessly integrate ```python from haystack import Pipeline -from haystack.components.retrievers import InMemoryEmbeddingRetriever +from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.generators import OpenAIGenerator from assemblyai_haystack.transcriber import AssemblyAITranscriber @@ -152,7 +152,7 @@ Explore the example below to see how to index speaker diarization information an ```python from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack import Pipeline -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.generators import OpenAIGenerator from assemblyai_haystack.transcriber import AssemblyAITranscriber diff --git a/integrations/cohere.md b/integrations/cohere.md index f1c14f8e..24800479 100644 --- a/integrations/cohere.md +++ b/integrations/cohere.md @@ -50,7 +50,7 @@ Below is the example indexing pipeline with `InMemoryDocumentStore`, `CohereDocu ```python from haystack import Document, Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.writers import DocumentWriter from cohere_haystack.embedders.document_embedder import CohereDocumentEmbedder @@ -77,7 +77,7 @@ Below is the example of generative questions answering pipeline using RAG with ` ```python from haystack import Pipeline -from haystack.components.retrievers import InMemoryEmbeddingRetriever +from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever from haystack.components.builders.prompt_builder import PromptBuilder from cohere_haystack.embedders.text_embedder import CohereTextEmbedder from cohere_haystack.generator import CohereGenerator diff --git a/integrations/gradient.md b/integrations/gradient.md index b39ad4db..a8d83860 100644 --- a/integrations/gradient.md +++ b/integrations/gradient.md @@ -42,7 +42,7 @@ You can use embedding models with `GradientDocumentEmbedder`` to create embeddin import os from haystack import Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.writers import DocumentWriter from haystack_integrations.components.embedders.gradient import GradientDocumentEmbedder @@ -69,7 +69,7 @@ You can use embedding models with `GradientTextEmbedder` and generative models w ```python from haystack.components.builders.answer_builder import AnswerBuilder from haystack.components.builders.prompt_builder import PromptBuilder -from haystack.components.retrievers import InMemoryEmbeddingRetriever +from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever from haystack_integrations.components.embedders.gradient import GradientTextEmbedder from haystack_integrations.components.generators.gradient import GradientGenerator diff --git a/integrations/huggingface.md b/integrations/huggingface.md index 50fedbad..2cdcc13c 100644 --- a/integrations/huggingface.md +++ b/integrations/huggingface.md @@ -51,7 +51,7 @@ Below is the example indexing pipeline with `InMemoryDocumentStore`, `DocumentWr ```python from haystack import Document from haystack import Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.embedders import SentenceTransformersDocumentEmbedder from haystack.components.writers import DocumentWriter @@ -80,7 +80,7 @@ Below is the example query pipeline that uses `mistralai/Mistral-7B-v0.1` hosted ```python from haystack import Pipeline -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.generators import HuggingFaceTGIGenerator @@ -117,8 +117,8 @@ Below is the example of document retrieval pipeline with `InMemoryBM25Retriever` ```python from haystack import Document, Pipeline -from haystack.document_stores import InMemoryDocumentStore -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.document_stores.in_memory import InMemoryDocumentStore +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.rankers import TransformersSimilarityRanker docs = [Document(content="Paris is in France"), @@ -148,8 +148,8 @@ Below is the example of extractive question answering pipeline with `InMemoryBM2 ```python from haystack import Document, Pipeline -from haystack.document_stores import InMemoryDocumentStore -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.document_stores.in_memory import InMemoryDocumentStore +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.readers import ExtractiveReader docs = [Document(content="Paris is the capital of France."), diff --git a/integrations/instructor-embedder.md b/integrations/instructor-embedder.md index fdd86fbb..8b8aca51 100644 --- a/integrations/instructor-embedder.md +++ b/integrations/instructor-embedder.md @@ -98,7 +98,7 @@ print(f"Embedding Dimension: {len(result['embedding'])}") ```python from instructor_embedders.instructor_document_embedder import InstructorDocumentEmbedder -from haystack.preview.dataclasses import Document +from haystack.dataclasses import Document doc_embedding_instruction = "Represent the Medical Document for retrieval:" @@ -147,11 +147,11 @@ print(f"Embedding Dimension: {len(result['documents'][0].embedding)}") ```python # Import necessary modules and classes -from haystack.preview.document_stores import InMemoryDocumentStore -from haystack.preview.dataclasses import Document -from haystack.preview import Pipeline -from haystack.preview.components.writers import DocumentWriter -from haystack.preview.components.retrievers import InMemoryEmbeddingRetriever +from haystack.document_stores.in_memory import InMemoryDocumentStore +from haystack.dataclasses import Document +from haystack import Pipeline +from haystack.components.writers import DocumentWriter +from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever from datasets import load_dataset # Import custom INSTRUCTOR Embedders diff --git a/integrations/jina.md b/integrations/jina.md index 48edb68a..b8635e53 100644 --- a/integrations/jina.md +++ b/integrations/jina.md @@ -54,7 +54,7 @@ Below is the example indexing pipeline with `InMemoryDocumentStore`, `JinaDocume ```python from haystack import Document, Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.writers import DocumentWriter from jina_haystack import JinaDocumentEmbedder diff --git a/integrations/lmformatenforcer.md b/integrations/lmformatenforcer.md index f305489b..f48148fa 100644 --- a/integrations/lmformatenforcer.md +++ b/integrations/lmformatenforcer.md @@ -100,7 +100,7 @@ To activate the the enforcer with Haystack V2, a `LMFormatEnforcerLocalGenerator Here is a simple example: ```python -from haystack.preview.components.generators.hugging_face.hugging_face_local import HuggingFaceLocalGenerator +from haystack.components.generators.hugging_face.hugging_face_local import HuggingFaceLocalGenerator from lmformatenforcer.integrations.haystackv2 import LMFormatEnforcerLocalGenerator diff --git a/integrations/notion-extractor.md b/integrations/notion-extractor.md index 368f8f03..40956d00 100644 --- a/integrations/notion-extractor.md +++ b/integrations/notion-extractor.md @@ -43,7 +43,7 @@ exported_pages = exporter.run(file_paths=[""]) The following example shows how to use the `NotionExporter` inside an indexing pipeline: ```python from notion_haystack import NotionExporter -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack import Pipeline document_store = InMemoryDocumentStore() diff --git a/integrations/ollama.md b/integrations/ollama.md index 98a02eb8..bb86e6ff 100644 --- a/integrations/ollama.md +++ b/integrations/ollama.md @@ -71,7 +71,7 @@ Below is the example of generative questions answering pipeline using RAG with ` ```python from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator diff --git a/integrations/openai.md b/integrations/openai.md index c4a3c6f8..fbfe15ae 100644 --- a/integrations/openai.md +++ b/integrations/openai.md @@ -50,7 +50,7 @@ Below is the example indexing pipeline with `InMemoryDocumentStore`, `OpenAIDocu ```python from haystack import Document, Pipeline -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.embedders import OpenAIDocumentEmbedder from haystack.components.writers import DocumentWriter @@ -78,7 +78,7 @@ Below is the example of generative questions answering pipeline using RAG with ` ```python from haystack import Pipeline -from haystack.components.retrievers import InMemoryBM25Retriever +from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.generators import GPTGenerator @@ -124,7 +124,7 @@ from haystack import Pipeline from haystack.components.audio import LocalWhisperTranscriber from haystack.components.preprocessors import DocumentSplitter, DocumentCleaner from haystack.components.writers import DocumentWriter -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore document_store = InMemoryDocumentStore() pipeline = Pipeline() @@ -159,7 +159,7 @@ Below is the example indexing pipeline with `PreProcessor`, `InMemoryDocumentSto ```python from haystack.nodes import EmbeddingRetriever -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.pipelines import Pipeline from haystack.schema import Document diff --git a/integrations/unstructured-file-converter.md b/integrations/unstructured-file-converter.md index a5fb8261..512629f4 100644 --- a/integrations/unstructured-file-converter.md +++ b/integrations/unstructured-file-converter.md @@ -51,9 +51,9 @@ documents = converter.run(paths = ["a/file/path.pdf", "a/directory/path"])["docu ### In a Haystack Pipeline ```python import os -from haystack.preview import Pipeline -from haystack.preview.components.writers import DocumentWriter -from haystack.preview.document_stores import InMemoryDocumentStore +from haystack import Pipeline +from haystack.components.writers import DocumentWriter +from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.converters.unstructured import UnstructuredFileConverter document_store = InMemoryDocumentStore() diff --git a/integrations/voyage.md b/integrations/voyage.md index 7d964ac4..a212169c 100644 --- a/integrations/voyage.md +++ b/integrations/voyage.md @@ -58,10 +58,10 @@ Load the dataset: # Install HuggingFace Datasets using "pip install datasets" from datasets import load_dataset from haystack import Pipeline -from haystack.components.retrievers import InMemoryEmbeddingRetriever +from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever from haystack.components.writers import DocumentWriter from haystack.dataclasses import Document -from haystack.document_stores import InMemoryDocumentStore +from haystack.document_stores.in_memory import InMemoryDocumentStore # Import Voyage Embedders from voyage_embedders.voyage_document_embedder import VoyageDocumentEmbedder