Docs
Sign inJoin the waitlist

Use a Model with LlamaIndex

A Model is an OpenAI-compatible chat model, so LlamaIndex’s OpenAILike LLM calls it. Set FACET_BASE_URL and FACET_API_KEY as in Call a Model.

pip install llama-index-llms-openai-like
import os
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="support-triage",
    api_base=os.environ["FACET_BASE_URL"],
    api_key=os.environ["FACET_API_KEY"],
    is_chat_model=True,
)
print(llm.complete("My card was charged twice").text)

Set is_chat_model=True: a Model answers only on the chat completions route. Send only the input. Facet adds the Model’s Instructions to every call, so leave out your own system prompt.

Next steps

Esc