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