diff --git a/.github/workflows/stainless-action.yml b/.github/workflows/stainless-action.yml index cce4669..568825c 100644 --- a/.github/workflows/stainless-action.yml +++ b/.github/workflows/stainless-action.yml @@ -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 diff --git a/.github/workflows/upload-to-stainless.yml b/.github/workflows/upload-to-stainless.yml new file mode 100644 index 0000000..006e2c5 --- /dev/null +++ b/.github/workflows/upload-to-stainless.yml @@ -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" diff --git a/src/ctxos/openapi.json b/src/ctxos/openapi.json new file mode 100644 index 0000000..3d9b8a2 --- /dev/null +++ b/src/ctxos/openapi.json @@ -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" + } + } + } + } + } + } + } +}