LlamaIndex

1

Install LlamaIndex

pip install llama-index openai
2

Add LangDB into your Code

import os

from llama_index.llms import openai
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.core import Settings
from llama_index.llms.openai import OpenAI

Settings.llm = OpenAI(
    base_url=os.getenv("OPENAI_API_BASE"),
    api_key=os.getenv("OPENAI_API_KEY"),
    model="gpt-4o-mini"
)

documents = SimpleDirectoryReader("data").load_data()
## Rest of your LlamaIndex

Check out full examples in the samples.

Last updated

Was this helpful?