Files
Fabric/docs/swagger.yaml
Kayvan Sylvan c06c94f8b8 # CHANGES
- Add Swagger UI at `/swagger/index.html` endpoint
- Generate OpenAPI spec files (JSON and YAML)
- Document chat, patterns, and models endpoints
- Update contributing guide with Swagger annotation instructions
- Add swaggo dependencies to project
- Configure authentication bypass for Swagger documentation
- Add custom YAML handler for OpenAPI spec
- Update REST API documentation with Swagger links
- Add dictionary entries for new tools
2025-12-18 07:12:08 -08:00

271 lines
6.2 KiB
YAML

basePath: /
definitions:
domain.ThinkingLevel:
enum:
- "off"
- low
- medium
- high
type: string
x-enum-varnames:
- ThinkingOff
- ThinkingLow
- ThinkingMedium
- ThinkingHigh
fsdb.Pattern:
properties:
description:
type: string
name:
type: string
pattern:
type: string
type: object
restapi.ChatRequest:
properties:
audioFormat:
type: string
audioOutput:
type: boolean
frequencyPenalty:
format: float64
type: number
imageBackground:
type: string
imageCompression:
type: integer
imageFile:
type: string
imageQuality:
type: string
imageSize:
type: string
language:
description: Add Language field to bind from request
type: string
maxTokens:
type: integer
model:
type: string
modelContextLength:
type: integer
notification:
type: boolean
notificationCommand:
type: string
presencePenalty:
format: float64
type: number
prompts:
items:
$ref: '#/definitions/restapi.PromptRequest'
type: array
raw:
type: boolean
search:
type: boolean
searchLocation:
type: string
seed:
type: integer
suppressThink:
type: boolean
temperature:
format: float64
type: number
thinkEndTag:
type: string
thinkStartTag:
type: string
thinking:
$ref: '#/definitions/domain.ThinkingLevel'
topP:
format: float64
type: number
voice:
type: string
type: object
restapi.PatternApplyRequest:
properties:
input:
type: string
variables:
additionalProperties:
type: string
type: object
type: object
restapi.PromptRequest:
properties:
contextName:
type: string
model:
type: string
patternName:
type: string
strategyName:
description: Optional strategy name
type: string
userInput:
type: string
variables:
additionalProperties:
type: string
description: Pattern variables
type: object
vendor:
type: string
type: object
restapi.StreamResponse:
properties:
content:
description: The actual content
type: string
format:
description: '"markdown", "mermaid", "plain"'
type: string
type:
description: '"content", "error", "complete"'
type: string
type: object
host: localhost:8080
info:
contact:
name: Fabric Support
url: https://github.com/danielmiessler/fabric
description: REST API for Fabric AI augmentation framework. Provides endpoints for
chat completions, pattern management, contexts, sessions, and more.
license:
name: MIT
url: https://opensource.org/licenses/MIT
title: Fabric REST API
version: "1.0"
paths:
/chat:
post:
consumes:
- application/json
description: Stream AI responses using Server-Sent Events (SSE)
parameters:
- description: Chat request with prompts and options
in: body
name: request
required: true
schema:
$ref: '#/definitions/restapi.ChatRequest'
produces:
- text/event-stream
responses:
"200":
description: Streaming response
schema:
$ref: '#/definitions/restapi.StreamResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- ApiKeyAuth: []
summary: Stream chat completions
tags:
- chat
/models/names:
get:
description: Get a list of all available AI models grouped by vendor
produces:
- application/json
responses:
"200":
description: Returns models (array) and vendors (map)
schema:
additionalProperties: true
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- ApiKeyAuth: []
summary: List all available models
tags:
- models
/patterns/{name}:
get:
consumes:
- application/json
description: Retrieve a pattern by name
parameters:
- description: Pattern name
in: path
name: name
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/fsdb.Pattern'
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- ApiKeyAuth: []
summary: Get a pattern
tags:
- patterns
/patterns/{name}/apply:
post:
consumes:
- application/json
description: Apply a pattern with variable substitution
parameters:
- description: Pattern name
in: path
name: name
required: true
type: string
- description: Pattern application request
in: body
name: request
required: true
schema:
$ref: '#/definitions/restapi.PatternApplyRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/fsdb.Pattern'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- ApiKeyAuth: []
summary: Apply pattern with variables
tags:
- patterns
securityDefinitions:
ApiKeyAuth:
in: header
name: X-API-Key
type: apiKey
swagger: "2.0"