Find answers from the community

Home
Members
🌸L e s b i a n🌸
�
🌸L e s b i a n🌸
Offline, last seen 3 months ago
Joined September 25, 2024
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)
5 comments
�
s