provider_options.go

 1package google
 2
 3import "charm.land/fantasy"
 4
 5type ThinkingConfig struct {
 6	ThinkingBudget  *int64 `json:"thinking_budget"`
 7	IncludeThoughts *bool  `json:"include_thoughts"`
 8}
 9
10type SafetySetting struct {
11	// 'HARM_CATEGORY_UNSPECIFIED',
12	// 'HARM_CATEGORY_HATE_SPEECH',
13	// 'HARM_CATEGORY_DANGEROUS_CONTENT',
14	// 'HARM_CATEGORY_HARASSMENT',
15	// 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
16	// 'HARM_CATEGORY_CIVIC_INTEGRITY',
17	Category string `json:"category"`
18
19	// 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',
20	// 'BLOCK_LOW_AND_ABOVE',
21	// 'BLOCK_MEDIUM_AND_ABOVE',
22	// 'BLOCK_ONLY_HIGH',
23	// 'BLOCK_NONE',
24	// 'OFF',
25	Threshold string `json:"threshold"`
26}
27type ProviderOptions struct {
28	ThinkingConfig *ThinkingConfig `json:"thinking_config"`
29
30	// Optional.
31	// The name of the cached content used as context to serve the prediction.
32	// Format: cachedContents/{cachedContent}
33	CachedContent string `json:"cached_content"`
34
35	// Optional. A list of unique safety settings for blocking unsafe content.
36	SafetySettings []SafetySetting `json:"safety_settings"`
37	// 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',
38	// 'BLOCK_LOW_AND_ABOVE',
39	// 'BLOCK_MEDIUM_AND_ABOVE',
40	// 'BLOCK_ONLY_HIGH',
41	// 'BLOCK_NONE',
42	// 'OFF',
43	Threshold string `json:"threshold"`
44}
45
46func (o *ProviderOptions) Options() {}
47
48func ParseOptions(data map[string]any) (*ProviderOptions, error) {
49	var options ProviderOptions
50	if err := fantasy.ParseOptions(data, &options); err != nil {
51		return nil, err
52	}
53	return &options, nil
54}