1
0
mirror of https://github.com/fumiama/deepinfra.git synced 2026-06-27 16:20:30 +08:00

feat: add custom

This commit is contained in:
源文雨
2025-02-14 16:29:37 +09:00
parent 507e407127
commit 12ba460588
6 changed files with 155 additions and 26 deletions

View File

@@ -10,8 +10,11 @@ const (
modelDeepDeek = "deepseek-ai/DeepSeek-R1"
)
// DeepSeek as an example.
// DeepSeek as an specified example.
type DeepSeek struct {
Inputer
Outputer
MessageBuilder[*DeepSeek]
// callback only
ID string `json:"id,omitempty"`
Object string `json:"object,omitempty"`
@@ -26,17 +29,6 @@ type DeepSeek struct {
}
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
type Choice struct {
Index int `json:"index"`
Message Message `json:"message"`
FinishReason string `json:"finish_reason"`
}
// NewDeepSeek 0.7, 0.9
func NewDeepSeek(temp, topp float32, maxn uint) *DeepSeek {
ds := new(DeepSeek)
@@ -47,6 +39,15 @@ func NewDeepSeek(temp, topp float32, maxn uint) *DeepSeek {
return ds
}
func (ds *DeepSeek) Body() *bytes.Buffer {
w := bytes.NewBuffer(make([]byte, 0, 16384))
err := json.NewEncoder(w).Encode(ds)
if err != nil {
panic(err)
}
return w
}
func (ds *DeepSeek) Parse(body io.Reader) error {
return json.NewDecoder(body).Decode(&ds)
}
@@ -89,12 +90,3 @@ func (ds *DeepSeek) Assistant(prompt string) *DeepSeek {
})
return ds
}
func (ds *DeepSeek) Body() *bytes.Buffer {
w := bytes.NewBuffer(make([]byte, 0, 16384))
err := json.NewEncoder(w).Encode(ds)
if err != nil {
panic(err)
}
return w
}