-
Notifications
You must be signed in to change notification settings - Fork 8
Adding swagger for EigenAI API #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7641f27
Adding swagger for EigenAI API
MadelineAu 139b49d
wip
MadelineAu 555b098
Merge remote-tracking branch 'origin/main' into swaggerExperiment
MadelineAu 94b164a
Add swagger docs for EigenAI API
MadelineAu eaa3d1b
Updated version
MadelineAu e41506e
Added disable_auto_reasoning_format
MadelineAu 075bb31
review rework
MadelineAu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| title: EigenAI API | ||
| sidebar_position: 1 | ||
| --- | ||
|
|
||
| Refer to the [swagger documentation for the EigenAI API](https://docs.eigencloud.xyz/api). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React, { useEffect } from "react"; | ||
| import SwaggerUI from "swagger-ui-dist/swagger-ui-es-bundle"; | ||
| import "swagger-ui-dist/swagger-ui.css"; | ||
|
|
||
| export default function ApiDocs() { | ||
| useEffect(() => { | ||
| SwaggerUI({ | ||
| dom_id: "#swagger-container", | ||
| url: "/openapi.yaml", | ||
| deepLinking: true, | ||
| }); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <div style={{ height: "100%" }}> | ||
| <div id="swagger-container" /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| openapi: 3.1.0 | ||
| info: | ||
| title: EigenAI Chat API | ||
| version: 0.1.0 | ||
| description: Chat completion API for EigenAI. | ||
|
|
||
| servers: | ||
| - url: https://api.eigencloud.xyz | ||
|
|
||
| paths: | ||
| /chat: | ||
| post: | ||
| summary: Create a chat completion | ||
| operationId: createChatCompletion | ||
| description: Generates a model response for a given chat conversation. | ||
|
|
||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
|
|
||
| model: | ||
| type: string | ||
| description: > | ||
| Model ID used to generate the response, e.g. `gpt-oss-120b-f16`. | ||
|
|
||
| messages: | ||
| type: array | ||
| description: A list of messages representing the conversation so far. | ||
| items: | ||
| type: object | ||
| properties: | ||
| role: | ||
| type: string | ||
| enum: [system, user, assistant, tool] | ||
| content: | ||
| type: string | ||
|
|
||
| disable_auto_reasoning_format: | ||
| type: boolean | ||
| description: > | ||
| Controls response parsing and separating out the reasoning trace from the content of the response. For client calls, this is a custom parameter. For example, in the OpenAI client, it's set in the `extra_body` field. Refer to the relevant client SDK documentation for information on how to set this parameter. | ||
|
|
||
| max_tokens: | ||
| type: integer | ||
| nullable: true | ||
| description: > | ||
| Optional. Maximum number of tokens to generate. | ||
|
|
||
| seed: | ||
| type: integer | ||
| nullable: true | ||
| description: > | ||
| Optional. If provided, inference becomes deterministic for repeated (seed + params). | ||
|
|
||
| stream: | ||
| type: boolean | ||
| nullable: true | ||
| description: > | ||
| Optional. If true, response is streamed using Server-Sent Events (SSE). | ||
|
|
||
| temperature: | ||
| type: number | ||
| format: float | ||
| nullable: true | ||
| description: > | ||
| Optional. Sampling temperature between 0 and 2. | ||
|
|
||
| top_p: | ||
| type: number | ||
| format: float | ||
| nullable: true | ||
| description: > | ||
| Optional. Nucleus sampling threshold (top-p). | ||
|
|
||
| logprobs: | ||
| type: boolean | ||
| nullable: true | ||
| description: > | ||
| Optional. If true, includes token-level log probabilities in the response. | ||
|
|
||
| frequency_penalty: | ||
| type: number | ||
| format: float | ||
| nullable: true | ||
| description: > | ||
| Optional. Number between -2.0 and 2.0 penalizing token repetition frequency. | ||
|
|
||
| presence_penalty: | ||
| type: number | ||
| format: float | ||
| nullable: true | ||
| description: > | ||
| Optional. Number between -2.0 and 2.0 penalizing previously seen tokens. | ||
|
|
||
| tools: | ||
| type: array | ||
| description: A list of tools the model may call. | ||
| items: | ||
| type: object | ||
| properties: | ||
| type: | ||
| type: string | ||
| enum: [function] | ||
| function: | ||
| type: object | ||
| properties: | ||
| name: | ||
| type: string | ||
| description: Name of the function. | ||
| description: | ||
| type: string | ||
| parameters: | ||
| type: object | ||
| description: JSON schema of function parameters. | ||
|
|
||
| tool_choice: | ||
| description: > | ||
| Optional. Controls how the model uses tools. | ||
| - `none`: never call tools | ||
| - `auto`: model decides (default if tools exist) | ||
| - `required`: must call tools | ||
| - or specify a particular function | ||
| oneOf: | ||
| - type: string | ||
| enum: [none, auto, required] | ||
| - type: object | ||
| properties: | ||
| type: | ||
| type: string | ||
| enum: [function] | ||
| function: | ||
| type: object | ||
| properties: | ||
| name: | ||
| type: string | ||
|
|
||
| required: | ||
| - model | ||
| - messages | ||
|
|
||
| responses: | ||
| "200": | ||
| description: Successful completion response. The response includes a cryptographic signature field that proves the response was generated by the EigenAI Operator (see [Verify Signature](https://docs.eigencloud.xyz/eigenai/howto/verify-signature) for more information). | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: string | ||
| object: | ||
| type: string | ||
| created: | ||
| type: integer | ||
| model: | ||
| type: string | ||
| choices: | ||
| type: array | ||
| items: | ||
| type: object | ||
| properties: | ||
| index: | ||
| type: integer | ||
| message: | ||
| type: object | ||
| properties: | ||
| role: | ||
| type: string | ||
| content: | ||
| type: string | ||
| finish_reason: | ||
| type: string | ||
| signature: | ||
| type: string | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpjunior92 can you comment on how the
disable_auto_reasoning_formatparameter works / should be documented here?Also, how is this parameter specified by a non-curl client?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable_auto_reasoning_formatis used to control response parsing. Here is how it is used:if
disable_auto_reasoning_formatis true, thenreasoning_formatis set to 0. ifdisable_auto_reasoning_formatis false, thenreasoning_formatis set to 1.reasoning_formatis a llama.cpp enum:TL;DR: this parameter enable / disable reasoning parsing at llama.cpp level.
@NimaVaziri curl is, among other things, an HTTP client, so setting this field is always the same across any HTTP client: set the field in the body according to the language syntax / tools:
Note: this is a custom parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpjunior92 Right, I was more so asking what the implication of this parameter is for other clients like the OpenAI client, the AI SDK client, etc - how can it be set (if it can be set)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each SDK may have its own way of setting this value, so users must look in the docs of their respective SDKs. Here is an example for OpenAI SDK using
extra_body:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MadelineAu let's make sure we include this as part of the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a look at this and have a couple of questions @NimaVaziri @mpjunior92
The
disable_auto_reasoning_formatparameter isn't currently included for the EigenAI API - was it missed? Or has it been added recently?We don't currently have any concept material that contextualizes what 'parsing at llama.cpp level' means - given the target audience, can I assume they would understand this statement? Or find an explanation to link out to?
This is a custom parameter - custom to us? Or custom as in not part of the OpenAI spec?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added recently.
"parsing at llama.cpp level" we don't need to include this phrasing. All we need to say is that "this parameter is used to control response parsing and separating out the reasoning from the content of the response".
It's not a custom parameter per se, it's a parameter at the llama.cpp level which we expose higher up. But in the context of a client call, you could say it's a custom parameter. Hopefully soon we can have a migration path where the parsed output becomes the default behavior and we can deprecate the parameter entirely.