Test: AI Client 生成测试
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
package ai
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGenerate(t *testing.T) {
|
||||||
|
client := NewClient(Config{
|
||||||
|
Endpoint: `https://api.siliconflow.cn/v1`,
|
||||||
|
Model: `Pro/deepseek-ai/DeepSeek-V3.2`,
|
||||||
|
Timeout: 120,
|
||||||
|
MaxRetries: 3,
|
||||||
|
ApiKey: `sk-rrizhcztbcpqvzszpsosxbylpuaajjropmzrcdzlqynhopzm`,
|
||||||
|
})
|
||||||
|
ans, err := client.Generate("你好")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%v", err)
|
||||||
|
}
|
||||||
|
if ans == "" {
|
||||||
|
t.Fatalf("无输出")
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Log(ans)
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user