Framework

LlamaIndex

RAG und Agents, europäische Inferenz.

Richte `OpenAILike` und `OpenAILikeEmbedding` auf unsere Base-URL. Indizes, Query-Engines und Agents: jedes LlamaIndex-Pattern, auf EU-Infrastruktur.

Python
from llama_index.core import Settings
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.openai_like import OpenAILikeEmbedding

Settings.llm = OpenAILike(
    model=class="s">"glm-5.1",
    api_base=class="s">"https://api.melious.ai/v1",
    api_key=class="s">"sk-mel-<YOUR_API_KEY>",
    is_chat_model=True,
    is_function_calling_model=True,
)

Settings.embed_model = OpenAILikeEmbedding(
    model_name=class="s">"bge-m3",
    api_base=class="s">"https://api.melious.ai/v1",
    api_key=class="s">"sk-mel-<YOUR_API_KEY>",
)
Über

What is LlamaIndex?

LlamaIndex ist ein Framework für Python und TypeScript mit Fokus auf Retrieval und strukturierte Daten für LLM-Apps. Indizes, Query-Engines und Agents, verbunden über ein globales Settings-Objekt. OpenAILike und OpenAILikeEmbedding sind der first-party-Weg, die ganze Pipeline auf einen Chat-Completions-Endpoint mit eigener Base-URL zu zeigen.

Zur offiziellen Website llamaindex.ai
Setup

Wie nutze ich LlamaIndex mit Melious?

  1. LlamaIndex installieren

    Core-Paket plus die openai-like-Adapter für LLM und Embeddings installieren. Sie sprechen Chat Completions, genau das, was Melious bedient.

    Shell
    pip install llama-index llama-index-llms-openai-like llama-index-embeddings-openai-like
    export MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY>
  2. Globale Settings konfigurieren

    Setz Settings.llm und Settings.embed_model einmal. Jeder Index, jede Query-Engine, jeder Agent liest daraus. is_chat_model=True und is_function_calling_model=True sind Pflicht für Agent-Workflows.

    Python
    import os
    from llama_index.core import Settings
    from llama_index.llms.openai_like import OpenAILike
    from llama_index.embeddings.openai_like import OpenAILikeEmbedding
    
    Settings.llm = OpenAILike(
        model=class="s">"glm-5.1",
        api_base=class="s">"https://api.melious.ai/v1",
        api_key=os.environ[class="s">"MELIOUS_API_KEY"],
        is_chat_model=True,
        is_function_calling_model=True,
    )
    
    Settings.embed_model = OpenAILikeEmbedding(
        model_name=class="s">"bge-m3",
        api_base=class="s">"https://api.melious.ai/v1",
        api_key=os.environ[class="s">"MELIOUS_API_KEY"],
    )
  3. Indexieren und abfragen

    Dokumente laden, Vector-Index bauen, abfragen. Sowohl der Embedding-Pass als auch der Completion-Call laufen über Melious. Für Agents: FunctionAgent aus llama_index.core.agent.workflow, die aktuelle LlamaIndex-API.

    Python
    from llama_index.core import SimpleDirectoryReader, VectorStoreIndex
    
    documents = SimpleDirectoryReader(class="s">"./docs").load_data()
    index = VectorStoreIndex.from_documents(documents)
    
    query_engine = index.as_query_engine()
    response = query_engine.query(class="s">"What does the onboarding flow do?")
    print(response)
Bereit?

Drei Schritte von hier.

Hol dir einen Melious-Key. Wähl dein Tool. Folg der Anleitung. Gleicher Client, antwortet jetzt aus Europa.