This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from edgenai/feat/modelmanager
[feat/modelmanager] models added
- Loading branch information
Showing
5 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,43 @@ | ||
#!/usr/bin/env -S npm run tsn -T | ||
|
||
import Edgen from 'edgen'; | ||
|
||
const client = new Edgen(); | ||
|
||
async function main() { | ||
const models = await client.models.list(); | ||
|
||
console.log("Models Listing"); | ||
console.log("=============="); | ||
for await (const model of models) { | ||
console.log("id : %s", model.id); | ||
console.log("type : %s", model.object); | ||
console.log("created: %s", model.created); | ||
console.log("owner : %s", model.owned_by); | ||
}; | ||
|
||
console.log("One Model"); | ||
console.log("========="); | ||
try { | ||
const model = await client.models.retrieve("TheFake%2fMy-fake-model-GGUF"); | ||
console.log("id : %s", model.id); | ||
console.log("type : %s", model.object); | ||
console.log("created: %s", model.created); | ||
console.log("owner : %s", model.owned_by); | ||
} catch (e) { | ||
console.log("ERROR: %s", e) | ||
} | ||
|
||
console.log("Delete Model"); | ||
console.log("============"); | ||
try { | ||
const model = await client.models.del("TheFake%2fMy-fake-model-GGUF"); | ||
console.log("id : %s", model.id); | ||
console.log("type : %s", model.object); | ||
console.log("deleted: %s", model.deleted); | ||
} catch (e) { | ||
console.log("ERROR: %s", e) | ||
} | ||
} | ||
|
||
main(); |
This file contains 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 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 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,76 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
import * as Core from 'edgen/core'; | ||
import { APIResource } from 'edgen/resource'; | ||
import * as ModelsAPI from 'edgen/resources/models'; | ||
import { Page } from 'edgen/pagination'; | ||
|
||
export class Models extends APIResource { | ||
/** | ||
* Retrieves a model instance, providing basic information about the model such as | ||
* the owner and permissioning. | ||
*/ | ||
retrieve(model: string, options?: Core.RequestOptions): Core.APIPromise<Model> { | ||
return this._client.get(`/models/${model}`, options); | ||
} | ||
|
||
/** | ||
* Lists the currently available models, and provides basic information about each | ||
* one such as the owner and availability. | ||
*/ | ||
list(options?: Core.RequestOptions): Core.PagePromise<ModelsPage, Model> { | ||
return this._client.getAPIList('/models', ModelsPage, options); | ||
} | ||
|
||
/** | ||
* Delete a fine-tuned model. You must have the Owner role in your organization to | ||
* delete a model. | ||
*/ | ||
del(model: string, options?: Core.RequestOptions): Core.APIPromise<ModelDeleted> { | ||
return this._client.delete(`/models/${model}`, options); | ||
} | ||
} | ||
|
||
/** | ||
* Note: no pagination actually occurs yet, this is for forwards-compatibility. | ||
*/ | ||
export class ModelsPage extends Page<Model> {} | ||
|
||
/** | ||
* Describes an OpenAI model offering that can be used with the API. | ||
*/ | ||
export interface Model { | ||
/** | ||
* The model identifier, which can be referenced in the API endpoints. | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* The Unix timestamp (in seconds) when the model was created. | ||
*/ | ||
created: number; | ||
|
||
/** | ||
* The object type, which is always "model". | ||
*/ | ||
object: 'model'; | ||
|
||
/** | ||
* The organization that owns the model. | ||
*/ | ||
owned_by: string; | ||
} | ||
|
||
export interface ModelDeleted { | ||
id: string; | ||
|
||
deleted: boolean; | ||
|
||
object: string; | ||
} | ||
|
||
export namespace Models { | ||
export import Model = ModelsAPI.Model; | ||
export import ModelDeleted = ModelsAPI.ModelDeleted; | ||
export import ModelsPage = ModelsAPI.ModelsPage; | ||
} |