llama-index
54 строки · 1.8 Кб
1"""Pinecone reader."""
2
3from typing import Any, Dict, List, Optional4
5from llama_index.legacy.readers.base import BaseReader6from llama_index.legacy.schema import Document7
8
9class PineconeReader(BaseReader):10"""Pinecone reader.11
12Args:
13api_key (str): Pinecone API key.
14environment (str): Pinecone environment.
15"""
16
17def __init__(self, api_key: str, environment: Optional[str] = None) -> None:18"""Initialize with parameters."""19raise NotImplementedError(20"PineconeReader has been deprecated. Please use `PineconeVectorStore` instead."21)22
23def load_data(24self,25index_name: str,26id_to_text_map: Dict[str, str],27vector: Optional[List[float]],28top_k: int,29separate_documents: bool = True,30include_values: bool = True,31**query_kwargs: Any32) -> List[Document]:33"""Load data from Pinecone.34
35Args:
36index_name (str): Name of the index.
37id_to_text_map (Dict[str, str]): A map from ID's to text.
38separate_documents (Optional[bool]): Whether to return separate
39documents per retrieved entry. Defaults to True.
40vector (List[float]): Query vector.
41top_k (int): Number of results to return.
42include_values (bool): Whether to include the embedding in the response.
43Defaults to True.
44**query_kwargs: Keyword arguments to pass to the query.
45Arguments are the exact same as those found in
46Pinecone's reference documentation for the
47query method.
48
49Returns:
50List[Document]: A list of documents.
51"""
52raise NotImplementedError(53"PineconeReader has been deprecated. Please use `PineconeVectorStore` instead."54)55