Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/stainless-action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build SDKs for pull request

env:
OAS_PATH: ./path/to/my/openapi.json
OAS_PATH: ./src/ctxos/openapi.json
STAINLESS_ORG: ctxos
STAINLESS_PROJECT: ctxos

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/upload-to-stainless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Upload to Stainless
on:
push:
branches:
- openapi

jobs:
upload_to_stainless:
runs-on: ubuntu-latest
name: Stainless — Upload OpenAPI specification
steps:
- uses: actions/checkout@v3
- uses: stainless-api/upload-openapi-spec-action@v0.2.1
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: "src/ctxos/openapi.json"
160 changes: 160 additions & 0 deletions src/ctxos/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"openapi": "3.1.0",
"info": {
"title": "CtxOS API",
"version": "1.0.0",
"description": "API for interacting with CtxOS completions and token utilities."
},
"servers": [
{
"url": "https://ctxos.github.io"
}
],
"paths": {
"/v1/complete": {
"post": {
"summary": "Create completion",
"operationId": "createCompletion",
"tags": ["Completions"],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CompletionCreateParams"
}
}
}
},
"responses": {
"200": {
"description": "Successful completion",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Completion"
}
}
}
}
}
}
},
"/v1/tokens/count": {
"post": {
"summary": "Count tokens",
"operationId": "countTokens",
"tags": ["Tokens"],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["input"],
"properties": {
"input": {
"type": "string",
"description": "Text to tokenize"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Token count",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tokens": {
"type": "integer",
"example": 42
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"CompletionCreateParams": {
"type": "object",
"required": ["model", "prompt"],
"properties": {
"model": {
"type": "string",
"example": "ctxos-1"
},
"prompt": {
"type": "string"
},
"max_tokens": {
"type": "integer",
"default": 256
},
"temperature": {
"type": "number",
"default": 0.7
}
}
},
"Completion": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "cmpl_abc123"
},
"object": {
"type": "string",
"example": "completion"
},
"model": {
"type": "string",
"example": "ctxos-1"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"index": {
"type": "integer"
},
"finish_reason": {
"type": "string",
"example": "stop"
}
}
}
},
"usage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
}
}
}
}
}
}
}
Loading