update docs

This commit is contained in:
Michael Yang 2023-11-15 15:22:12 -08:00
parent 652d90e1c7
commit 54f92f01cb
2 changed files with 30 additions and 9 deletions

View file

@ -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 ### Create a Blob
```shell ```shell
@ -337,17 +361,15 @@ Create a blob from a file. Returns the server file path.
#### Examples #### Examples
##### Request
```shell ```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 Return 201 Created if the blob was successfully created.
{
"path": "/home/user/.ollama/models/blobs/sha256:29fdb92e57cf0827ded04ae6461b5931d01fa595843f55d36f5b275a52087dd2"
}
```
## List Local Models ## List Local Models

View file

@ -764,6 +764,7 @@ func Serve(ln net.Listener, allowOrigins []string) error {
r.DELETE("/api/delete", DeleteModelHandler) r.DELETE("/api/delete", DeleteModelHandler)
r.POST("/api/show", ShowModelHandler) r.POST("/api/show", ShowModelHandler)
r.POST("/api/blobs/:digest", CreateBlobHandler) r.POST("/api/blobs/:digest", CreateBlobHandler)
r.HEAD("/api/blobs/:digest", HeadBlobHandler)
for _, method := range []string{http.MethodGet, http.MethodHead} { for _, method := range []string{http.MethodGet, http.MethodHead} {
r.Handle(method, "/", func(c *gin.Context) { 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.Handle(method, "/api/tags", ListModelsHandler)
} }
r.HEAD("/api/blobs/:digest", HeadBlobHandler)
log.Printf("Listening on %s (version %s)", ln.Addr(), version.Version) log.Printf("Listening on %s (version %s)", ln.Addr(), version.Version)
s := &http.Server{ s := &http.Server{
Handler: r, Handler: r,