mirror of
https://github.com/fumiama/deepinfra.git
synced 2026-06-27 08:10:28 +08:00
feat: add Google GenAI API
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OLLaMA as an specified example.
|
||||
@@ -35,6 +36,15 @@ func NewOLLaMA(model, sep string, temp, topp float32, maxn uint) *OLLaMA {
|
||||
return opai
|
||||
}
|
||||
|
||||
func (*OLLaMA) API(api, _ string) string {
|
||||
return api
|
||||
}
|
||||
|
||||
func (*OLLaMA) Header(key string, h http.Header) {
|
||||
h.Add("Content-Type", "application/json")
|
||||
h.Add("Authorization", "Bearer "+key)
|
||||
}
|
||||
|
||||
func (ollm *OLLaMA) Body() *bytes.Buffer {
|
||||
w := bytes.NewBuffer(make([]byte, 0, 8192))
|
||||
err := json.NewEncoder(w).Encode(ollm)
|
||||
|
||||
Reference in New Issue
Block a user