Find answers from the community

Updated 9 months ago

Here's the code from the docs I'm trying

Here's the code from the docs I'm trying to run
Plain Text
import nest_asyncio

nest_asyncio.apply()

import os

os.environ["MISTRAL_API_KEY"] = "YOUR MISTRALAI API KEY"

from llama_index.llms.mistralai import MistralAI
from llama_index.embeddings.mistralai import MistralAIEmbedding
from llama_index.core import Settings

llm = MistralAI(model="mistral-large", temperature=0.1)
embed_model = MistralAIEmbedding(model_name="mistral-embed")

Settings.llm = llm
Settings.embed_model = embed_model


Plain Text
from llama_index.core import SimpleDirectoryReader

uber_docs = SimpleDirectoryReader(input_files=["./uber_2021.pdf"]).load_data()
lyft_docs = SimpleDirectoryReader(input_files=["./lyft_2021.pdf"]).load_data()


Plain Text
from llama_index.core import VectorStoreIndex

uber_index = VectorStoreIndex.from_documents(uber_docs)
uber_query_engine = uber_index.as_query_engine(similarity_top_k=5)

response = uber_query_engine.query("What is the revenue of uber in 2021?")
print(response)
s
5 comments
try adding a system prompt in MistralAI()
system_prompt: Optional[str] = None
Plain Text
SYSTEM_PROMPT = "You are a helpful assistant."

llm = MistralAI(model="mistral-large", temperature=0.1, system_prompt=SYSTEM_PROMPT) 
Getting the same error as before, and just to clarify this only occurs when I access Mistral's API via Llama index
Also, this only happens with mistral-large
Add a reply
Sign up and join the conversation on Discord