I am having a devilish time attempting to analyze the cost of a query with MockLLMPredictor. I keep getting
--------------------------------------------------------------------------
AuthenticationError Traceback (most recent call last)
File c:\Users\happy\Documents\Projects\askLavinia\.venv\lib\site-packages\tenacity\__init__.py:382, in Retrying.__call__(self, fn, *args, **kwargs)
381 try:
--> 382 result = fn(*args, **kwargs)
383 except BaseException: # noqa: B902
File c:\Users\happy\Documents\Projects\askLavinia\.venv\lib\site-packages\llama_index\embeddings\openai.py:106, in get_embedding(text, engine, **kwargs)
105 text = text.replace("\n", " ")
--> 106 return openai.Embedding.create(input=[text], model=engine, **kwargs)["data"][0][
107 "embedding"
108 ]
File c:\Users\happy\Documents\Projects\askLavinia\.venv\lib\site-packages\openai\api_resources\embedding.py:33, in Embedding.create(cls, *args, **kwargs)
32 try:
---> 33 response = super().create(*args, **kwargs)
35 # If a user specifies base64, we'll just return the encoded string.
36 # This is only for the default case.
File c:\Users\happy\Documents\Projects\askLavinia\.venv\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py:149, in EngineAPIResource.create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
127 @classmethod
128 def create(
129 cls,
(...)
136 **params,
...
--> 326 raise retry_exc from fut.exception()
328 if self.wait:
329 sleep = self.wait(retry_state)
RetryError: RetryError[]
yet, the query works fine when I set up the query with:
st.session_state['query_engine'] = index.as_query_engine(verbose=True)
Has anyone gotten the ability to retrieve tokens and then figure out the cost ? Thank you.