Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
54f92f01
Commit
54f92f01
authored
Nov 15, 2023
by
Michael Yang
Browse files
update docs
parent
652d90e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
docs/api.md
docs/api.md
+29
-7
server/routes.go
server/routes.go
+1
-2
No files found.
docs/api.md
View file @
54f92f01
...
...
@@ -323,6 +323,30 @@ A stream of JSON objects. When finished, `status` is `success`.
}
```
### Check if a Blob Exists
```
shell
HEAD /api/blobs/:digest
```
Check if a blob is known to the server.
#### Query Parameters
-
`digest`
: the SHA256 digest of the blob
#### Examples
##### Request
```
shell
curl
-I
http://localhost:11434/api/blobs/sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2
```
##### Response
Return 200 OK if the blob exists, 404 Not Found if it does not.
### Create a Blob
```
shell
...
...
@@ -337,17 +361,15 @@ Create a blob from a file. Returns the server file path.
#### Examples
##### Request
```
shell
curl
-X
POST http://localhost:11434/api/blobs/sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2
-d
@llama2-13b-q4_0.gguf
curl
-T
model.bin
-X
POST http://localhost:11434/api/blobs/sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2
```
#### Response
####
#
Response
```
json
{
"path"
:
"/home/user/.ollama/models/blobs/sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2"
}
```
Return 201 Created if the blob was successfully created.
## List Local Models
...
...
server/routes.go
View file @
54f92f01
...
...
@@ -764,6 +764,7 @@ func Serve(ln net.Listener, allowOrigins []string) error {
r
.
DELETE
(
"/api/delete"
,
DeleteModelHandler
)
r
.
POST
(
"/api/show"
,
ShowModelHandler
)
r
.
POST
(
"/api/blobs/:digest"
,
CreateBlobHandler
)
r
.
HEAD
(
"/api/blobs/:digest"
,
HeadBlobHandler
)
for
_
,
method
:=
range
[]
string
{
http
.
MethodGet
,
http
.
MethodHead
}
{
r
.
Handle
(
method
,
"/"
,
func
(
c
*
gin
.
Context
)
{
...
...
@@ -773,8 +774,6 @@ func Serve(ln net.Listener, allowOrigins []string) error {
r
.
Handle
(
method
,
"/api/tags"
,
ListModelsHandler
)
}
r
.
HEAD
(
"/api/blobs/:digest"
,
HeadBlobHandler
)
log
.
Printf
(
"Listening on %s (version %s)"
,
ln
.
Addr
(),
version
.
Version
)
s
:=
&
http
.
Server
{
Handler
:
r
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment