FILE / ScuroNeko/go-deepseek
README.md
Исходный файл и его история в репозитории.
51 lines
841 B
Markdown
51 lines
841 B
Markdown
# GoDeepSeek
|
|
|
|
## Requirements:
|
|
- CGO enabled
|
|
- x86_64 CPU with AVX2 (Intel Haswell 2013+, AMD Ryzen 2017+)
|
|
- C++17 compiler (GCC 7+, Clang 5+, MSVC 2017+)
|
|
|
|
|
|
## Quick start
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"git.scuroneko.dev/scuroneko/go-deepseek"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
ds := deepseek.NewClient()
|
|
ds.SetDeviceIDProvider(deepseek.RandomDeviceIDProvider())
|
|
// Flow #1
|
|
err := ds.Login("email", "password")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Flow #2
|
|
ds.SetToken("TOKEN")
|
|
|
|
chatRes, err := ds.CreateChatWithContext(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
res, err := ds.CompletionWithContext(ctx, *deepseek.NewCompletionReq(chatRes.ID).SetPrompt("Hello"))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
str, err := deepseek.ReadStreamAsString(ctx, res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
log.Println(str)
|
|
}
|
|
```
|