1
0
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:
源文雨
2025-03-30 01:48:52 +09:00
parent bf0f65bcaa
commit db7712b6d2
7 changed files with 153 additions and 5 deletions

View File

@@ -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)