DEVUP Docs
Back to Dashboard

Integrations

LlamaIndex

LlamaIndex is a data framework for building RAG pipelines and agents. Connect it to DEVUP AI through the OpenAI-compatible API.

Prerequisites

Install

bash
pip install llama-index-core llama-index-llms-openai-like llama-index-embeddings-openai-like

Set your API key

export DEVUP_API_KEY="your-key"

Chat

python
import os

from llama_index.core.llms import ChatMessage
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="deepseek-ai/DeepSeek-V4-Pro",
    api_base="https://api.devupai.com/v1",
    api_key=os.environ["DEVUP_API_KEY"],
    is_chat_model=True,
    is_function_calling_model=True,
    context_window=1048576,
    max_tokens=512,
    timeout=120,
)

response = llm.chat([ChatMessage(role="user", content="Reply with exactly: Salam DEVUP")])
print(response.message.content)

Output: Salam DEVUP

Streaming

python
for chunk in llm.stream_chat([ChatMessage(role="user", content="Count from 1 to 5, separated by spaces.")]):
    print(chunk.delta, end="", flush=True)
print()

Tool calling

Set is_function_calling_model=True and pass tools to chat_with_tools.

python
from llama_index.core.tools import FunctionTool


def multiply(a: int, b: int) -> int:
    """Multiply two integers and return the product."""
    return a * b


tool = FunctionTool.from_defaults(fn=multiply)
response = llm.chat_with_tools([tool], user_msg="What is 12 multiplied by 34? Use the multiply tool.")

for call in llm.get_tool_calls_from_response(response, error_on_no_tool_call=False):
    print(call.tool_name, call.tool_kwargs, "->", multiply(**call.tool_kwargs))

Output: multiply {'a': 12, 'b': 34} -> 408

Embeddings

python
from llama_index.embeddings.openai_like import OpenAILikeEmbedding

embed_model = OpenAILikeEmbedding(
    model_name="BAAI/bge-m3",
    api_base="https://api.devupai.com/v1",
    api_key=os.environ["DEVUP_API_KEY"],
)

vector = embed_model.get_text_embedding("Salam DEVUP")
print(len(vector))

Output: 1024

RAG

python
from llama_index.core import Document, Settings, VectorStoreIndex

Settings.llm = llm
Settings.embed_model = embed_model

documents = [
    Document(text="The internal project codename is Atlas."),
    Document(text="The team meets every Tuesday morning."),
    Document(text="The office coffee machine is on the second floor."),
]

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine(similarity_top_k=2)
print(query_engine.query("What is the internal project codename?"))

The query engine retrieves the two most similar documents and answers from them.

Choosing models

Use exact catalog IDs for model and model_name. For tool calling, choose a model whose catalog entry supports it. See Models.

Troubleshooting

  • Authentication error (401)Set DEVUP_API_KEY in the same terminal that runs your script, without a Bearer prefix.
  • Model not foundUse the exact catalog ID for model and model_name.
  • No tool calls returnedSet is_function_calling_model=True and choose a model whose catalog entry supports tool calling.