Docs

Plugsky RAG — full documentation

Reference documentation for Plugsky's RAG API. Collections, document upload, embeddings, retrieval, and citations. Your data never trains a model.

1. Create a collection

python
from openai import OpenAI
client = OpenAI(base_url="https://api.plugsky.com/v1", api_key="sk-live-...")

c = client.rag.collections.create(name="acme-handbook")
print(c.id)

2. Upload documents

python
with open("handbook.pdf", "rb") as f:
    doc = client.rag.documents.create(
        collection_id=c.id,
        file=f,
        metadata={"department": "engineering"},
    )

3. Query

python
result = client.rag.query.create(
    collection_id=c.id,
    query="What is our vacation policy?",
    top_k=5,
)
for chunk in result.chunks:
    print(f"[{chunk.score:.2f}] {chunk.text[:80]}")
    print(f"   source: {chunk.source}")

4. Compose with chat

python
context = "

".join(c.text for c in result.chunks)
resp = client.chat.completions.create(
    model="plugsky-pro",
    messages=[
        {"role":"system","content":f"Answer using this context. Cite sources.\n\n{context}"},
        {"role":"user","content":"What is our vacation policy?"},
    ],
)

See /articles/rag-api for the full feature overview.

Try RAG in your stack

Free trial, private by default.

Start $5 trial →