インストール
OpenAI互換LLMを設定する
インデックスで使う
注意事項
- サードパーティのOpenAI互換APIには
OpenAILikeを使います。 - 生成モデルと埋め込みモデルのIDは明示します。LlamaIndexのデフォルトがPhaseoを指すとは限りません。
- Phaseoの埋め込みを使う場合は、PhaseoモデルIDと同じBase URLで埋め込みモデルを設定します。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
LlamaIndexのRAGワークフローでPhaseoを使います。
pip install llama-index llama-index-llms-openai-like llama-index-embeddings-openai-like
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model="openai/gpt-5-nano",
api_key=os.environ["PHASEO_API_KEY"],
api_base="https://api.phaseo.app/v1",
is_chat_model=True,
)
response = llm.complete("Write one sentence about retrieval quality.")
print(response)
from llama_index.core import Settings
Settings.llm = llm
OpenAILikeを使います。