Open shashvatsinha opened 1 month ago
@shashvatsinha
LiteLLM:ERROR: cost_calculator.py:673
Is this causing the call to fail? or just a warning?
I rechecked. Here's how I'm using it with Qdrant and LlamaIndex:
try:
vector_store = QdrantVectorStore(client=client, collection_name="github_prs")
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(
documents,
storage_context=storage_context,
)
except Exception as e:
print (f"Caught exception {e}")
It works, it doesn't raise an exception.
That said, this is the secondary issue - primary issue is still that the LiteLLMEmbedding() call requires an api_key parameter to be passed for Voyage, otherwise it fails. If I need to put in if-else code for different providers when calling LiteLLMEmbedding, then I might as well implement my own factory method and use VoyageEmbedding, OpenAIEmbedding and BedrockEmbedding directly.
@shashvatsinha how're you setting the api key param for voyage?
.env file and VOYAGE_API_KEY Same as all the others (OPENAI_API_KEY etc).
i.e. with any other embedding model, I don't have to set api_key = os.getenv('PROVIDER_KEY') They all pick up their PROVIDER_KEY environment variable when used with LiteLLMEmbed.
But when using a voyage model, it doesn't work, and I have to specify api_key = os.getenv('VOYAGE_API_KEY').
About the second bug from cost calculator, it is because prompt_tokens
in the response from Voyage API is None
.
CreateEmbeddingResponse(data=[Embedding(embedding=[], index=0, object='embedding')], model='voyage-code-2', object='list', usage=Usage(prompt_tokens=None, total_tokens=7))
What happened?
When using LlamaIndex, if I do the following:
Then api_key is not picked up from VOYAGE_API_KEY, and LiteLLM / Voyage throws a 401 error:
But if I do:
then it correctly picks up the API key from VOYAGE_API_KEY and the call works.
This is probably a second bug and should be filed as so, but I'm guessing that it would be the first question anyone asks, so leaving it here: If I provide the API key like so:
Then I get the following error:
Relevant log output
No response
Twitter / LinkedIn details
https://www.linkedin.com/in/shashvat/