You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
518 B
32 lines
518 B
3 weeks ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
|
||
|
"github.com/ollama/ollama/api"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
client, err := api.ClientFromEnvironment()
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
|
||
|
ctx := context.Background()
|
||
|
|
||
|
req := &api.PullRequest{
|
||
|
Model: "mistral",
|
||
|
}
|
||
|
progressFunc := func(resp api.ProgressResponse) error {
|
||
|
fmt.Printf("Progress: status=%v, total=%v, completed=%v\n", resp.Status, resp.Total, resp.Completed)
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
err = client.Pull(ctx, req, progressFunc)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|