-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.go
More file actions
66 lines (54 loc) · 2.43 KB
/
request.go
File metadata and controls
66 lines (54 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package augur
// Request defines what data to retrieve and how.
type Request struct {
// Query is the natural language description of the data to retrieve.
Query string
// Schema is the JSON Schema defining the expected output shape.
// When nil, the schema is derived from the generic type parameter T via
// reflection. When provided explicitly (via SchemaFromJSON or SchemaFromFile),
// it takes precedence over reflection.
//
// A schema is always required — the library never infers one on its own.
// Returns ErrSchemaInvalid if neither T yields a valid schema nor an
// explicit Schema is provided.
Schema *Schema
// Context is optional additional context injected into the LLM prompt to
// improve result quality (e.g., "Focus on the actor's personal life").
Context string
// Options are per-query configuration overrides for client defaults.
Options *QueryOptions
}
// QueryOptions provides per-query overrides for client-level defaults.
type QueryOptions struct {
// Model overrides the client's default model for this query.
Model string
// Temperature controls LLM randomness. Default: 0.0 (deterministic).
Temperature *float64
// MaxTokens overrides the client's default max output tokens for this query.
MaxTokens *int
// Sources configures web search and source citations for this query.
// When nil, the source configuration defined at the client level is used
// (web search is enabled by default).
// Provide a SourceConfig to customize web search behavior
// or set Disabled: true to turn off web search for this query.
//
// Not all models support web search; if the requested model is incompatible,
// Query returns ErrSourcesNotSupported.
Sources *SourceConfig
}
// SourceConfig configures source citations backed by web search.
// Web search is enabled by default. Set Disabled to true to turn it off,
// which avoids web search cost and returns empty FieldMeta.Sources.
type SourceConfig struct {
// Disabled turns off web search entirely when true. When false (the
// default), web search is active and FieldMeta.Sources will contain
// real URLs from search results.
Disabled bool
// MaxSearches limits the number of web searches per query.
// Nil defaults to 2. Higher values increase cost and token usage.
MaxSearches *int
// AllowedDomains restricts search results to these domains only.
AllowedDomains []string
// BlockedDomains excludes search results from these domains.
BlockedDomains []string
}