Skip to content

daptin/daptin-llm-demo

Repository files navigation

Daptin LLM Demo

Demo and API contract test for Daptin's OpenAI-compatible LLM endpoints.

Key idea: This webapp uses the official OpenAI JS SDK pointed at Daptin. If the SDK works without patches, the API contract is proven compatible with any downstream client.

What it tests

Test Validates
GET /v1/models Model listing returns {object: "list", data: [...]}
POST /v1/chat/completions Non-streaming: correct chat.completion object, choices, usage
POST /v1/chat/completions (stream) SSE format: data: {...}\n\n, chunk objects, [DONE] terminator
POST /v1/completions Legacy endpoint maps prompt to chat
Error: invalid model Returns 404 with {error: {message, type}}
Error: missing model Returns 400 with error object

Quick start

Standalone (with existing Daptin)

npm install
node server.js
# Open http://localhost:7777
# Enter your Daptin URL + JWT token in the config bar

Auto-setup (creates provider + credential)

cp .env.example .env.local
# Edit .env.local with your Daptin credentials and LLM API key
npm install
node scripts/setup.js   # creates credential + llm_provider in Daptin
node server.js

Docker Compose (full stack)

export LLM_API_KEY=sk-...
docker compose up
# Daptin at :6336, Demo at :7777

Architecture

Browser (openai JS SDK)
    |
    v
  Daptin (:6336)
  /v1/chat/completions  -->  llm_provider table  -->  GoAI SDK  -->  OpenAI / Anthropic / Vertex / etc.
  /v1/models
  /v1/embeddings
    ^
    |
  Demo (:7777) -- serves UI + runs contract tests

The demo webapp makes direct fetch() calls using the exact same JSON format as the OpenAI SDK. Each test validates response structure field-by-field against the OpenAI spec.

License

MIT

About

Demo and API contract test for Daptin's OpenAI-compatible LLM endpoints

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors