BazaarLinkBazaarLink
登入
文件API 参考SDK 参考Agent 应用AI Skills
章节导航

LlamaIndex

LlamaIndex

在 LlamaIndex RAG 管线中使用 BazaarLink。LlamaIndex 支援 OpenAI 相容的 base URL,更改两个参数即可。

from llama_index.llms.openai import OpenAI
from llama_index.core import Settings

Settings.llm = OpenAI(
    model="openai/gpt-4o",
    api_base="https://api.bazaarlink.ai/v1",
    api_key="sk-bl-YOUR_API_KEY",
)

# Now use LlamaIndex normally — it calls BazaarLink
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader

documents = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What is this documentation about?")
print(response)
客服
您好!有什么可以协助?
请留下消息,我们会尽快回复。
LlamaIndex | BazaarLink