69 lines
1.6 KiB
Go
69 lines
1.6 KiB
Go
// this package provides a wrapper to test completion provider implementations.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.chandlerswift.com/chandlerswift/svs-services-server/completion/openrouter"
|
|
)
|
|
|
|
var provider = openrouter.OpenRouterProvider{
|
|
Token: os.Getenv("OPENROUTER_API_KEY"),
|
|
Model: "openai/gpt-oss-120b",
|
|
}
|
|
|
|
func main() {
|
|
prompt := "Generate a sample weather report."
|
|
|
|
// {
|
|
// name: 'weather',
|
|
// strict: true,
|
|
// schema: {
|
|
// type: 'object',
|
|
// properties: {
|
|
// location: {
|
|
// type: 'string',
|
|
// description: 'City or location name',
|
|
// },
|
|
// temperature: {
|
|
// type: 'number',
|
|
// description: 'Temperature in Celsius',
|
|
// },
|
|
// conditions: {
|
|
// type: 'string',
|
|
// description: 'Weather conditions description',
|
|
// },
|
|
// },
|
|
// required: ['location', 'temperature', 'conditions'],
|
|
// additionalProperties: false,
|
|
// },
|
|
// },
|
|
// }
|
|
schema := map[string]any{
|
|
"name": "weather",
|
|
"strict": true,
|
|
"schema": map[string]any{
|
|
"type": "object",
|
|
"properties": map[string]any{
|
|
"location": map[string]any{
|
|
"type": "string",
|
|
"description": "City or location name",
|
|
},
|
|
"temperature": map[string]any{
|
|
"type": "number",
|
|
"description": "Temperature in Celsius",
|
|
},
|
|
"conditions": map[string]any{
|
|
"type": "string",
|
|
"description": "Weather conditions description",
|
|
},
|
|
},
|
|
"required": []string{"location", "temperature", "conditions"},
|
|
"additionalProperties": false,
|
|
},
|
|
}
|
|
result, err := provider.Complete(context.TODO(), prompt, schema)
|
|
fmt.Println(err, result)
|
|
}
|