Find answers from the community

Home
Members
Siddhant Saurabh
S
Siddhant Saurabh
Offline, last seen 3 months ago
Joined September 25, 2024
hey
We have been trying DocumentSummaryIndex, but found out this particular problem
eg. before inserting we had 25 no. of nodes but DocumentSummaryIndex inserted only one node in the pinecone
have attached the code for inserting nodes, the runtime output for on of nodes while inserting is 25 and the actual no. of nodes inserted (is only 1)
currently we are using latest llama_index 0.9.25.post1
Have you come acrossing this before? Can you please tell me how come only one node is getting inserted? Am I missing some parameters?
3 comments
S
L
hey , ,
having problem of nodes not getting stored in pinecone when trying to store DocumentSummaryIndex nodes in Pinecone Vector store. (though it is working for GPTVectorStoreIndex)
Below is the attached snippet.
(I have gone through both the DocumentSummaryIndex and GPTVectorStoreIndex, both inherit the class BaseIndex and both seems to have the function _build_index_from_nodes() and _add_nodes_to_index() which is being called in the constructor of BaseIndex. It seems I have not initialising the storage context correctly for storing of DocumentSummaryIndex)
Please assist and suggest what needs to be updated in the snippet.
1 comment
S
hey
have found an issue of truncating queries.
"Query has been truncated from the right"
can you please confirm if this is from llama_index? and if yes why this is raised?
2 comments
L
hey , , ,
we trying to use 10+ nodes in prompt formation
our paramters being
model = gpt-4-32k,
model_context_window = 25000,
chat_history_max_tokens = 4000,
max_output_tokens = 500,
index_response_mode = compact

but still refine prompts are getting started.
(currently we are using 3 nodes, with the parameters model = gpt-4, model_context_window=7500, max_output_token=500, and compact mode and there is no problem with refine prompt.)
with refine prompts we have faced degradation in answer quality, so wanted a solution.
please assist
1 comment
L
another issue we face in filtering was

  1. the doc_id filter in VectorIndexRetriever is not working as expected, the filtering does not work
  2. and is there any way to pass doc_id filter to VectorIndexAutoRetriever (Pinecone auto retriever)?
1 comment
L
Hi while working with llama-index==0.6.35
faced the following issues
with the meta data
Plain Text
metadata = {
                "provider": provider,
                "admin_id": admin_id,
                "chunk_size": int(self.chunk_size),
                "chunk_overlap": int(self.chunk_overlap),
                "num_indexes": int(num_indexes),
                "category": tag,
                "page_label": page_no,
                "provider":<provider>,
                "document_name":document_name,
                "organisation_name":organisation_name,
                "uploaded_at":get_current_date()
            }
Document(
                    text=clean_text(text),
                    doc_id=f"{document_id}",
                    metadata=metadata,
                    excluded_llm_metadata_keys=[
                        "category",
                        "page_label",
                        "num_indexes",
                        "chunk_overlap",
                        "chunk_size",
                        "admin_id",
                    ],
                    excluded_embed_metadata_keys=[
                        "category",
                        "page_label",
                        "num_indexes",
                        "chunk_overlap",
                        "chunk_size",
                        "admin_id",
                    ],
                    metadata_seperator=" | ",
                    metadata_template="{key} = {value}",
                    text_template="Metadata: {metadata_str}\n=====\nContent: {content}",
                )

1st while generating text for llm using above we get Metadata: : Content, twice in the text
2nd the embedding text too had the same problem, even the evaluation prompt too
3rd was not able to access doc_id from old nodes
4th the quality of answer too went down with the new metadata version, though the new prompt made more sense (using gpt4) 🤔
6 comments
L
S
hey , ,
while using Pinecone auto-retriever for
1> assigning multiple tags per category
eg
Plain Text
from llama_index.data_structs.node import Node

nodes = [
    Node("Michael Jordan is a retired professional basketball player, widely regarded as one of the greatest basketball players of all time.", extra_info={
        "category": ["Sports", "Entertainment"],
        "country": "United States",
    })

we get error ValueError: Value must be one of (str, int, float, None)

2> incase a query is "Tell me about two sport persons and business men from United States"
even through gpt gives the response
Plain Text
{"query": "sport persons business men", "filters": [{"key": "category", "value": "Sports"}, {"key": "category", "value": "Business"}, {"key": "country", "value": "United States"}], "top_k": 2}

but auto-retriever only uses one value per category.
Plain Text
Using filters: {'category': 'Business', 'country': 'United States'} #here sport was not used


can you please confim if this is a bug?
1 comment
L
hey ,
we have seen the Auto Retriever (https://gpt-index.readthedocs.io/en/latest/examples/vector_stores/pinecone_auto_retriever.html)
I had some questions
1> will this work with a nodes having multiple tags per category
2> will this scale well with our use-case (i.e. a company can have a lot of documents and about 15-20 tags and documents many will have similar tags),
so should you advise using this for better filtration of nodes?
(as for us we will have to summarize the whole document then classify under multiple classes for storing and then passing the multiple classes in MetadataInfo for finding the best tags for the user's query)
2 comments
L
S
do we have any other text preprocessor apart from textsplitter and recursivetextsplitter?
for one document textsplitter works good and sometime on other recuresivetextsplitter works good, sometimes neither of them.
cc: , ,
1 comment
L
hey from 0.6.2 llama_index, we are seeing that Document extra parameter is also getting added to text while adding to pinecone vector store?
how can we remove them? (this is polluting/disturbing the search with embedding while using pinecone)
cc:
15 comments
d
S
k
L
hey, we are using Pinecone with cosine similarity.
Will adding one more level of filtering using CohereAI Reranker be beneficial?
cc:
5 comments
L
a
r
S
hey,
I went through CustomRetriever for utilizing it as one shot selector for selecting b/w different query index. Have gone through Query Transformations, but it seems to be a mechanism of converting a query into different query(s) for better search.
but how do we define one shot selector type llama_index inside _retrieve method.
the method for selecting nodes in CustomRetriever seems to be rule based for and and or operation but not intelliget selector
Plain Text
        if self._mode == "AND":
            retrieve_ids = vector_ids.intersection(keyword_ids)
        else:
            retrieve_ids = vector_ids.union(keyword_ids)

very confused here, please help
cc:
3 comments
j
S
L
hey , ,
acc. to you what should be a good description for the tool for querying GPTPineconeIndex in langchain
if our use case is to use GPTPineconeIndex for getting answers related to the company handbook.
currently using "Use this to answer every question from the company handbooks"
2 comments
L
what parameter do I need to set in query() to get only the sources and no call to openai?
1 comment
L
known this, you can see I have used in implementation 3
but index = GPTPineconeIndex([], pinecone_index=index)
can not be queried because it is empty, right?
4 comments
L
S
k
hey , I am trying to implement the async feature for processing all the similarity_top_k nodes in gptsimplevectorindex(). the feature is working perfectly when I use this in a standalone script. But when I try to integrate it in the service where there is already an even_loop() in the calling method, the async parametered gptsimplevectorindex() is stuck. any way to solve it?
3 comments
j
S
Siddhant Saurabh
·

hey

hey
@Logan M , @disiok, @ravitheja

while using streaming = True in get_response_synthesizer()
Plain Text
        response_synthesizer = get_response_synthesizer(
            service_context=self.service_context,
            text_qa_template=qa_chat_prompt,
            response_mode=self.index_response_mode,
            streaming= True
        )

        custom_index = RetrieverQueryEngine(
            retriever=custom_retriever,
            response_synthesizer=response_synthesizer,
            node_postprocessors=[
                SimilarityPostprocessor(similarity_cutoff=self.similarity_cutoff),
            ],
        )

we get an error

we are using following llm in service_context
Plain Text
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
            model=self.model_name,
            temperature=self.temperature,
            model_kwargs=model_kwargs,
            max_tokens=self.max_output_tokens,
            api_key=api_key,
            base_url=base_url
        )

I see an open issue but in github https://github.com/run-llama/llama_index/issues/9873
can you please suggest what's the fix?
1 comment
S
hey @Logan M @ravitheja @jerryjliu0
would you advise using Weaviate Vector Store instead of Pinecone?
(as I just found that Weaviate does not support adding or deleting properties to the schema. so changing any schema would require to delete and adding the nodes again)
2 comments
r
L
hey @Logan M
how to get the nodes with embedding back from GPTVectorStoreIndex()
here is the sample code
Plain Text
    def store_index(self, documents, payload, service_context):
        with self.lock:
            parser = service_context.node_parser
            nodes = parser.get_nodes_from_documents(documents)

            storage_context = self.get_pinecone_storage_context(payload, toquery=False)

            storage_context.docstore.add_documents(nodes)

            pc_index = GPTVectorStoreIndex(
                nodes,
                storage_context=storage_context,
                service_context=service_context,
            )

            if "oldDocumentId" in payload:
                self.delete_old_vector(payload)
                
        return pc_index

can we extract out nodes with embedding from pc_index?
6 comments
L
W
S
hey @jerryjliu0 @Logan M @ravitheja ,
I tried to add parallelize the evaluation under the llama_index>evaluation>base.py> QueryResponseEvaluator
the code is in the attachment
The code is working but then I notice in the debug mode that we are sending the same context for checking multiple times.
can you please help?
3 comments
S
L
hey getting error, when trying to use gpt-4-0613 with
LLMPredictor(ChatOpenAI(model = 'gpt-4-0613'))
Plain Text
Error -  Unknown model: gpt-4-0613. Please provide a valid OpenAI model name.Known models are: gpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301, text-ada-001, ada, text-babbage-001, babbage, text-curie-001, curie, davinci, text-davinci-003, text-davinci-002, code-davinci-002, code-davinci-001, code-cushman-002, code-cushman-001.

please help
cc: @Logan M @ravitheja
5 comments
S
L
do we have support for https://docs.nomic.ai/ as a vector store, similar to pinecone?
cc: @ravitheja @Logan M
2 comments
L
S
hey, I wanted to build a tools
where we call open ai directly to open ai without any context (no source is utilized)
the tool will used inside query_engine_tools parameter of RouterQueryEngine
can you please help
cc: @ravitheja @Logan M @jerryjliu0
5 comments
L
S
hey, can we pass headers while initializing Embedding model for the service context
Background we want to integrate PortKey.
we can do so in from langchain.chat_models import ChatOpenAI
eg
Plain Text
self.llm = ChatOpenAI(
            model=self.model_name,
            temperature=self.temperature,
            max_tokens=self.max_tokens,
            frequency_penalty=self.frequency_penalty,
            top_p=self.top_p,
            headers = {
                <some_header>
            }
        )

        # LLM Predictor
        self.llm_predictor = LLMPredictor(llm=self.llm)

works
so how can we pass the headers in from llama_index.embeddings.openai import OpenAIEmbedding
cc: @Logan M @jerryjliu0 @ravitheja
8 comments
r
S
hey

what is the latest method of inserting nodes in pinecone for 0.6.0
Plain Text
from llama_index.vector_stores import PineconeVectorStore
from llama_index.storage.storage_context import StorageContext

#"Insert"ing
vector_store = PineconeVectorStore(
    pinecone_index=index,
    add_sparse_vector=True,
)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = pinecone.Index("dobby-springworks-be-dev")
pcv_index = GPTVectorStoreIndex.from_documents(documents,pinecone_index=index, metadata_filters ={'doc_name': 'Handbook', 'admin_name': 'Siddhant', 'user_name': 'Siddhant'}, namespace='temp')
# for doc_chunk in documents:
#     pcv_index.insert(doc_chunk)
print(index.describe_index_stats())

from above the before no. of total vector and after vector remains same, the above also does not give any error, but the before no. of total vector and after vector remains same 🤔
@ravitheja @Logan M
3 comments
S
r