Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ ollama.ps()

- Returns: `<ListResponse>`

### version

```javascript
ollama.version()
```

- Returns: `<VersionResponse>`

### abort

```javascript
Expand Down
7 changes: 4 additions & 3 deletions src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
WebSearchResponse,
WebFetchRequest,
WebFetchResponse,
VersionResponse,
} from './interfaces.js'
import { defaultHost } from './constant.js'

Expand Down Expand Up @@ -72,7 +73,7 @@
*/
protected async processStreamableRequest<T extends object>(
endpoint: string,
request: { stream?: boolean } & Record<string, any>,

Check warning on line 76 in src/browser.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
): Promise<T | AbortableAsyncIterator<T>> {
request.stream = request.stream ?? false
const host = `${this.config.host}/api/${endpoint}`
Expand Down Expand Up @@ -329,13 +330,13 @@

/**
* Returns the Ollama server version.
* @returns {Promise<{version: string}>} - The server version object.
* @returns {Promise<VersionResponse>} - The server version object.
*/
async version(): Promise<{ version: string }> {
async version(): Promise<VersionResponse> {
const response = await utils.get(this.fetch, `${this.config.host}/api/version`, {
headers: this.config.headers,
})
return (await response.json()) as { version: string }
return (await response.json()) as VersionResponse
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
function: {
name: string;
arguments: {
[key: string]: any;

Check warning on line 79 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
};
};
}
Expand All @@ -89,15 +89,15 @@
type?: string;
parameters?: {
type?: string;
$defs?: any;

Check warning on line 92 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
items?: any;

Check warning on line 93 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
required?: string[];
properties?: {
[key: string]: {
type?: string | string[];
items?: any;

Check warning on line 98 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
description?: string;
enum?: any[];

Check warning on line 100 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
};
};
};
Expand Down Expand Up @@ -267,11 +267,15 @@
details: ModelDetails
messages: Message[]
modified_at: Date
model_info: Map<string, any>,

Check warning on line 270 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
capabilities: string[],
projector_info?: Map<string, any>

Check warning on line 272 in src/interfaces.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
}

export interface VersionResponse {
version: string
}

export interface ListResponse {
models: ModelResponse[]
}
Expand Down
Loading