Find answers from the community

Home
Members
Nate Patterson FT25
N
Nate Patterson FT25
Offline, last seen 3 months ago
Joined September 25, 2024
Trying to install and use llama-index in a google colab instance. Has anyone encountered this error before? llama-index installation is verified:

ImportError Traceback (most recent call last)
<ipython-input-5-3ae358b1f615> in <cell line: 10>()
8 # from langchain_text_splitters import RecursiveCharacterTextSplitter
9
---> 10 from llama_index.embeddings import HuggingFaceEmbedding

ImportError: cannot import name 'HuggingFaceEmbedding' from 'llama_index.embeddings' (unknown location)
4 comments
N
L
I'm struggling with a straightforward use case. Use case: I am adding to a Pinecone VectorDB documents with specific metadata.

metadata_filters = {"document_name": document_name}
vector_store = PineconeVectorStore(
index_name=index_name,
environment=environment,
metadata_filters=metadata_filters,
)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
print('create storage context')
# Load the document
document = loader.load_data()

# Create index from document
document_name = VectorStoreIndex.from_documents(
document,
storage_context=storage_context,
service_context=service_context,
)
# Set summary text for document
document_name.index_struct.index_id = document_name


I want to be able to query specific documents instead of the entire index. I implemented metadata filtering, however, my response is none, even though I have checked that the metadata (with an exact match) exists. I have also checked that a response is returned when I remove all filters.

pinecone.init(api_key=PINECONE_API_KEY, environment=environment)

llm = OpenAI(temperature=0, model="gpt-3.5-turbo", max_tokens=1024)
service_context = ServiceContext.from_defaults(llm=llm)
vector_store = PineconeVectorStore(pinecone.Index("test"))
index = VectorStoreIndex.from_vector_store(vector_store=vector_store)
query_engine = index.as_query_engine(similarity_top_k=5,
service_context=service_context,
filters=MetadataFilters(
filters=[ExactMatchFilter(key='document_name', value=document_name)]
)
)
response = query_engine.query(instruction)
print(response)

What is wrong with this approach?
6 comments
N
L