LlamaIndex
LlamaIndex RAG 파이프라인에서 BazaarLink을 사용하세요. LlamaIndex는 모든 OpenAI 호환 엔드포인트를 지원합니다 — 두 개의 파라미터만 변경하면 됩니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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",
)
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)