Skip to content

Commit

Permalink
fix: digest path param in Ollama blob endpoints (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmigloz authored May 20, 2024
1 parent fd15793 commit 2e9e935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/ollama_dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ await for (final res in stream) {

#### Check if a Blob Exists

Check if a blob is known to the server.
Ensures that the file blob used for a FROM or ADAPTER field exists on the server. This is checking your Ollama server and not Ollama.ai.

```dart
await client.checkBlob(
name: 'sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2',
digest: 'sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2',
);
```

Expand Down
22 changes: 9 additions & 13 deletions packages/ollama_dart/lib/src/generated/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -605,51 +605,47 @@ class OllamaClient {

/// Create a blob from a file. Returns the server file path.
///
/// `name`: the SHA256 digest of the blob
/// `digest`: the SHA256 digest of the blob
///
/// `request`: No description
///
/// `POST` `http://localhost:11434/api/blobs/{digest}`
Future<void> createBlob({
required String name,
required String digest,
String? request,
}) async {
final _ = await makeRequest(
baseUrl: 'http://localhost:11434/api',
path: '/blobs/{digest}',
path: '/blobs/$digest',
method: HttpMethod.post,
isMultipart: false,
requestType: 'application/octet-stream',
responseType: '',
body: request,
queryParams: {
'name': name,
},
);
}

// ------------------------------------------
// METHOD: checkBlob
// ------------------------------------------

/// Check to see if a blob exists on the Ollama server which is useful when creating models.
/// Ensures that the file blob used for a FROM or ADAPTER field exists on the server.
///
/// `name`: the SHA256 digest of the blob
/// This is checking your Ollama server and not Ollama.ai.
///
/// `digest`: the SHA256 digest of the blob
///
/// `HEAD` `http://localhost:11434/api/blobs/{digest}`
Future<void> checkBlob({
required String name,
required String digest,
}) async {
final _ = await makeRequest(
baseUrl: 'http://localhost:11434/api',
path: '/blobs/{digest}',
path: '/blobs/$digest',
method: HttpMethod.head,
isMultipart: false,
requestType: '',
responseType: '',
queryParams: {
'name': name,
},
);
}
}
11 changes: 6 additions & 5 deletions packages/ollama_dart/oas/ollama-curated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ paths:
operationId: checkBlob
tags:
- Models
summary: Check to see if a blob exists on the Ollama server which is useful when creating models.
summary: Ensures that the file blob used for a FROM or ADAPTER field exists on the server.
description: This is checking your Ollama server and not Ollama.ai.
parameters:
- in: query
name: name
- in: path
name: digest
schema:
type: string
required: true
Expand All @@ -218,8 +219,8 @@ paths:
- Models
summary: Create a blob from a file. Returns the server file path.
parameters:
- in: query
name: name
- in: path
name: digest
schema:
type: string
required: true
Expand Down

0 comments on commit 2e9e935

Please sign in to comment.