Find answers from the community

Home
Members
navya1260
n
navya1260
Offline, last seen 3 months ago
Joined September 25, 2024
n
navya1260
·

Error

Sometimes I get this error in rag with gemini or gemini flash - Invalid payload! Need prompt and completion or messages and response. Is there a way to fix it?
1 comment
L
from llama_index.core.node_parser import SentenceSplitter
ModuleNotFoundError: No module named 'llama_index.core.node_parser'
im getting this error today suddenly, i wasn't getting this error before.

this is my version
llama-index 0.10.54.post1
llama-index-agent-openai 0.2.8
llama-index-cli 0.1.12
llama-index-core 0.10.54
llama-index-embeddings-huggingface 0.2.2
llama-index-embeddings-openai 0.1.10
llama-index-indices-managed-llama-cloud 0.2.4
llama-index-legacy 0.9.48
llama-index-llms-gemini 0.1.11
llama-index-llms-openai 0.1.25
llama-index-multi-modal-llms-openai 0.1.7
llama-index-program-openai 0.1.6
llama-index-question-gen-openai 0.1.3
llama-index-readers-file 0.1.30
llama-index-readers-llama-parse 0.1.6
llama-index-vector-stores-elasticsearch 0.2.1
1 comment
L
Hi, is it possible to use gemini/open ai for entity metadata extraction here instead of default tomaarsen/span-marker-mbert-base-multinerd?
entity_extractor = EntityExtractor(prediction_threshold=0.5, label_entities=False, # include the entity label in the document (can be erroneous)
device="cpu", # set to "cuda" if you have a GPU
)
1 comment
L
import tiktoken
from llama_index.core.callbacks import CallbackManager, TokenCountingHandler
token_counter = TokenCountingHandler(
tokenizer=tiktoken.encoding_for_model("gpt-3.5-turbo").encode
)
I use this to calculate token usage for gpt models.
How do i calculate token usage for gemini based models like gemini-pro or gemini-1.5-flash-latest?
15 comments
n
L
How to use GPT4-0 in open ai model,
when i use this -> Settings.llm = OpenAI(model="gpt-4o")
i get this error
ValueError: Unknown model 'gpt-4o'. Please provide a valid OpenAI model name in: gpt-4, gpt-4-32k, gpt-4-1106-preview, gpt-4-0125-preview, gpt-4-turbo-preview, gpt-4-vision-preview, gpt-4-turbo-2024-04-09, gpt-4-turbo, gpt-4-0613, gpt-4-32k-0613, gpt-4-0314, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo-0301, text-davinci-003, text-davinci-002, gpt-3.5-turbo-instruct, text-ada-001, text-babbage-001, text-curie-001, ada, babbage, curie, davinci, gpt-35-turbo-16k, gpt-35-turbo, gpt-35-turbo-0125, gpt-35-turbo-1106, gpt-35-turbo-0613, gpt-35-turbo-16k-0613
3 comments
L
n
n
navya1260
·

Error

from llama_index.core.ingestion import IngestionPipeline
from llama_index.core.node_parser import TokenTextSplitter
from elasticsearch import Elasticsearch, NotFoundError
from llama_index.extractors.entity import EntityExtractor

def run_pipeline(self, docs):
try:
text_splitter = TokenTextSplitter(
separator=" ", chunk_size=512, chunk_overlap=128
)
entity_extractor = EntityExtractor(prediction_threshold=0.5, label_entities=False, # include the entity label in the metadata (can be erroneous)
device="cpu", # set to "cuda" if you have a GPU
)
pipeline = IngestionPipeline(
transformations=[text_splitter, entity_extractor]
)
return pipeline.run(
documents=docs,
in_place=True,
show_progress=True,
)
except Exception as e:
logging.error(f"Error running pipeline: {e}")
return None
when i run this pipeline, I get this error - ERROR:root:Error running pipeline: too many values to unpack (expected 2).
when the code goes to extracting entities part, i get this error.
3 comments
L
n
Can I use "BAAI/bge-small-en-v1.5" - embel model with gemini pro model? or will it work only for open ai?
3 comments
n
s
T
Im trying to implement rag and I have already implemented using open ai and have stored the embeddings in elastic search and used open ai for retrieval and output. Now i want to try the same with gemini-pro model. How can i do that? I can only see customizations with paid llm apis. Gemini pro is free api and I am unable to find the documentation for adding gemini pro as llm model/embedding. Can you please help?
2 comments
L
import tiktoken
from llama_index.core.callbacks import CallbackManager, TokenCountingHandler
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings


token_counter = TokenCountingHandler(
tokenizer=tiktoken.encoding_for_model("gpt-3.5-turbo").encode
)

Settings.llm = OpenAI(model="gpt-3.5-turbo", temperature=0.2)
Settings.callback_manager = CallbackManager([token_counter])
Here, can we use this tokencountinghandler with BAAI/bge small model instead of open ai? If so how?
2 comments
L
from llama_index.vector_stores.elasticsearch import ElasticsearchStore
from llama_index.core import VectorStoreIndex, StorageContext

from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters

Initialize the vector store

vector_store = ElasticsearchStore(
index_name="",
es_url=es_cloud_id,
es_user=es_user,
es_password=es_password,
verify_certs=False,
) for this code, im getting this error:
vector_store = ElasticsearchStore(
30 index_name="",
31 es_url=es_cloud_id,
32 es_user=es_user,
33 es_password=es_password,
34 verify_certs=False,
35
36 )
38 # Create a storage context
39 storage_context = StorageContext.from_defaults(vector_store=vector_store)

TypeError: ElasticsearchStore.init() got an unexpected keyword argument 'verify_certs'
10 comments
n
L
AttributeError
Cell In[1], line 26
21 from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters
25 # Initialize the vector store
---> 26 vector_store = ElasticsearchStore(
27 index_name="",
28 es_cloud_id="",
29 es_user="",
30 es_password="",
33 )
/venv/lib/python3.11/site-packages/llama_index/vector_stores/elasticsearch/base.py:197, in ElasticsearchStore.init(self, index_name, es_client, es_url, es_cloud_id, es_api_key, es_user, es_password, text_field, vector_field, batch_size, distance_strategy)
193 self._client = es_client.options(
194 headers={"user-agent": self.get_user_agent()}
195 )
196 elif es_url is not None or es_cloud_id is not None:
--> 197 self._client = _get_elasticsearch_client(
198 es_url=es_url,
199 username=es_user,
200 password=es_password,
...
230 """Get user agent for elasticsearch client."""
231 import llama_index
--> 233 return f"llama_index-py-vs/{llama_index.core.version}"
AttributeError: module 'llama_index.core' has no attribute 'version'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
The code is given below:
from llama_index.vector_stores.elasticsearch import ElasticsearchStore
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters

Initialize the vector store

vector_store = ElasticsearchStore(
index_name="",
es_cloud_id="",
es_user="",
es_password="",
)
4 comments
n
L
v