Skip to content

Commit

Permalink
[feat/modelmanager] docs added
Browse files Browse the repository at this point in the history
  • Loading branch information
toschoo committed Feb 19, 2024
1 parent b26eefc commit c227346
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 1 deletion.
235 changes: 235 additions & 0 deletions docs/src/app/api-reference/models/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
export const metadata = {
title: 'Models',
description: 'Model Management (e.g. list models, retrieve model information, remove models) API requests.',
}

# Models

Discover how to manage your local models. OpenAI compliant. {{ className: 'lead' }}

---

## list models {{ tag: 'GET', label: 'http://localhost:33322/v1/models ' }}

<Row>
<Col>

Lists all local models.

### Response attributes

<Properties>
<Property name="object" type="string">
The type of this object, always "list".
</Property>
<Property name="page" type="integer">
Current page.
</Property>
<Property name="per_page" type="integer">
Number of model descriptors per page.
</Property>
<Property name="data" type="ModelDesc[]">
The model descriptors for all local models.
<Property name="id" type="string">
Unique identifier of this model.
</Property>
<Property name="created" type="integer">
Unix Timestamp of the creation time of this model.
</Property>
<Property name="object" type="string">
The type of this item, always "model".
</Property>
<Property name="owned_by" type="string">
Owner of the model repository.
</Property>
</Property>
</Properties>
</Col>

<Col sticky>

<CodeGroup title="Request" tag="GET" label="v1/models">

```bash {{ title: 'cURL' }}
curl http://localhost:33322/v1/models\
-H "Authorization: Bearer no-key-required"
```

```python
from edgen import Edgen
client = Edgen()
models = client.models.list()
for m in models:
print(m)
```
```ts
import fs from "fs";
import Edgen from "edgen";
const client = new Edgen();
async function main() {
const models = await client.models.list();
for for await (const model of models) {
console.log(model);
}
}
main();
```
</CodeGroup>
```json {{ title: 'Response' }}
{
"object":"list","data":[
{"id":"TheBloke/neural-chat-7B-v3-3-GGUF","created":1708333035,"object":"model","owned_by":"TheBloke"},
{"id":"TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF","created":1708333060,"object":"model","owned_by":"TheBloke"},
{"id":"TheBloke/phi-2-GGUF","created":1708333062,"object":"model","owned_by":"TheBloke"},
{"id":"distil-whisper/distil-small.en","created":1708333030,"object":"model","owned_by":"distil-whisper"}
],
"page":1,
"per_page":4
}
```
</Col>
</Row>
---
## retrieve model {{ tag: 'GET', label: 'http://localhost:33322/v1/models{model} ' }}
<Row>
<Col>
Retrieve model information.
### Response attributes
<Properties>
<Property name="id" type="string">
Unique identifier of this model.
</Property>
<Property name="created" type="integer">
Unix Timestamp of the creation time of this model.
</Property>
<Property name="object" type="string">
The type of this item, always "model".
</Property>
<Property name="owned_by" type="string">
Owner of the model repository.
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="GET" label="v1/models">
```bash {{ title: 'cURL' }}
curl http://localhost:33322/v1/models/TheBloke%2fneural-chat-7B-v3-3-GGUF \
-H "Authorization: Bearer no-key-required"
```
```python
from edgen import Edgen
client = Edgen()
model = client.models.retrieve("TheBloke%2fneural-chat-7B-v3-3-GGUF")
print(m)
```
```ts
import fs from "fs";
import Edgen from "edgen";
const client = new Edgen();
async function main() {
const model = await client.models.retrieve("TheBloke%2fneural-chat-7B-v3-3-GGUF");
console.log(model);
}
main();
```
</CodeGroup>
```json {{ title: 'Response' }}
{
"id":"TheBloke/neural-chat-7B-v3-3-GGUF","created":1708333035,"object":"model","owned_by":"TheBloke"
}
```
</Col>
</Row>
---
## delete model {{ tag: 'GET', label: 'http://localhost:33322/v1/delete{model} ' }}
<Row>
<Col>
Delete local model.
### Response attributes
<Properties>
<Property name="id" type="string">
Unique identifier of this model.
</Property>
<Property name="object" type="string">
The type of this item, always "model".
</Property>
<Property name="deleted" type="bool">
Whether the model was actually deleted.
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="GET" label="v1/models">
```bash {{ title: 'cURL' }}
curl -X DELETE http://localhost:33322/v1/models/TheBloke%2fneural-chat-7B-v3-3-GGUF \
-H "Authorization: Bearer no-key-required"
```
```python
from edgen import Edgen
client = Edgen()
status = client.models.delete("TheBloke%2fneural-chat-7B-v3-3-GGUF")
print(status)
```
```ts
import fs from "fs";
import Edgen from "edgen";
const client = new Edgen();
async function main() {
const status = await client.models.del("TheBloke%2fneural-chat-7B-v3-3-GGUF");
console.log(status);
}
main();
```
</CodeGroup>
```json {{ title: 'Response' }}
{
"id":"TheBloke/neural-chat-7B-v3-3-GGUF","object":"model","deleted":true
}
```
</Col>
</Row>
---
17 changes: 16 additions & 1 deletion docs/src/components/Endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { GridPattern } from '@/components/GridPattern'
import { Heading } from '@/components/Heading'
import { ChatBubbleIcon } from '@/components/icons/ChatBubbleIcon'
import { MicrophoneIcon } from '@/components/icons/MicrophoneIcon'
import { CubeIcon } from '@/components/icons/CubeIcon'
import { EnvelopeIcon } from '@/components/icons/EnvelopeIcon'
import { UserIcon } from '@/components/icons/UserIcon'
import { UsersIcon } from '@/components/icons/UsersIcon'
Expand Down Expand Up @@ -45,7 +46,7 @@ const endpoints: Array<Endpoint> = [
href: '/api-reference/chat',
name: 'Chat',
description:
'Create a chat response, given an list of input chat messages.',
'Create a chat response, given a list of input chat messages.',
icon: ChatBubbleIcon,
pattern: {
y: 16,
Expand All @@ -55,6 +56,20 @@ const endpoints: Array<Endpoint> = [
],
},
},
{
href: '/api-reference/models',
name: 'Models',
description:
'Manage models: list local models, retrieve model information and remove models.',
icon: CubeIcon,
pattern: {
y: 16,
squares: [
[0, 1],
[1, 3],
],
},
},
]

function EndpointIcon({ icon: Icon }: { icon: Endpoint['icon'] }) {
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export const navigation: Array<NavGroup> = [
links: [
{ title: 'Audio', href: '/api-reference/audio' },
{ title: 'Chat', href: '/api-reference/chat' },
{ title: 'Models', href: '/api-reference/models' },
],
},
]
Expand Down
12 changes: 12 additions & 0 deletions docs/src/components/icons/CubeIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function CubeIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox = "0 0 24 24" aria-hidden="true" {...props}>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"
/>
</svg>
)
}

0 comments on commit c227346

Please sign in to comment.