-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
discussions: Remote API Extension #3505
Comments
Dupe of #3374 |
Separation of Concerns
Draw.iohttps://drive.google.com/file/d/1pl9WjCzKl519keva85aHqUhx2u0onVf4/view?usp=sharing
|
Idea from @norrybul: janhq/models#23 (comment) |
Hi @dan-homebrew, that's what we initially thought we should do, but there are a couple of problems, so we've pushed back the Custom OAI Extension:
|
Using
|
Hey @0xSage, an extension-builder can offer a JSON, then call We don't offer an API for users to register a new remote provider endpoint via extension code, as it's merely a utility or a small example they can copy over from our provided examples. The extension framework is designed to supply APIs that facilitate the interaction of extensions with the application. I already added the example of:
// Register models with JSON file
override async onLoad(): Promise<void> {
super.onLoad()
// Register Settings (API Key, Endpoints)
this.registerSettings(SETTINGS)
// Pre-populate models - persist model.json files
// MODELS are model.json files that come with the extension.
this.registerModels(MODELS)
}
// Register models with provider models list endpoint
override async onLoad(): Promise<void> {
super.onLoad()
// Register Settings (API Key, Endpoints)
this.registerSettings(SETTINGS)
// Fetch models from provider models endpoint - just a simple fetch
// Default to `/models`
get('/models')
.then((models) => {
// Model builder will construct model template (aka preset)
// This operation builds Model DTOs that works with the app.
// They can transform model parameters right here for supported settings
this.registerModels(this.modelBuilder.build(models))
})
}
/**
* transformPayload Example
* Tranform the payload before sending it to the inference endpoint.
* The new preview models such as o1-mini and o1-preview replaced max_tokens by max_completion_tokens parameter.
* Others do not.
*/
transformPayload = (payload: OpenAIPayloadType): OpenAIPayloadType => {
// Transform the payload for preview models
if (this.previewModels.includes(payload.model)) {
const { max_tokens, ...params } = payload
return { ...params, max_completion_tokens: max_tokens }
}
// Pass through for officialw models
return payload
} |
Goal
list
API)model.yaml
for each remote modelTasklist
Out-of-scope
groq-extension
)Tasklist
Remote API Extensions
Existing Issues
The text was updated successfully, but these errors were encountered: