Documentation
¶
Index ¶
- func IsGrokClientContext(ctx context.Context, headers http.Header) bool
- func IsGrokClientHeaders(headers http.Header) bool
- func IsGrokClientUserAgent(userAgent string) bool
- func IsGrokShellUserAgent(userAgent string) bool
- func IsKeepalivePayload(payload []byte) bool
- func IsKeepaliveSSELine(line []byte) bool
- func KeepaliveSSEComment() []byte
- func TransformKeepaliveSSELine(line []byte, isGrokClient bool) ([]byte, bool)
- type ModelEntry
- type ModelInfo
- type ReasoningEffort
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGrokClientContext ¶
IsGrokClientContext checks if either the context (e.g. Gin context) or headers indicate a Grok client.
func IsGrokClientHeaders ¶
IsGrokClientHeaders checks if the provided HTTP headers indicate a Grok client.
func IsGrokClientUserAgent ¶
IsGrokClientUserAgent checks if the user agent contains "grok-pager" or "grok-shell".
func IsGrokShellUserAgent ¶
IsGrokShellUserAgent checks if the User-Agent header indicates a Grok Shell client.
func IsKeepalivePayload ¶
IsKeepalivePayload reports whether a JSON payload has type "keepalive".
func IsKeepaliveSSELine ¶
IsKeepaliveSSELine reports whether an SSE line represents a keepalive event or data frame.
func KeepaliveSSEComment ¶
func KeepaliveSSEComment() []byte
KeepaliveSSEComment returns the standard SSE comment used for keepalive.
func TransformKeepaliveSSELine ¶
TransformKeepaliveSSELine transforms a keepalive SSE line into an SSE comment line when isGrokClient is true. If the line is not a keepalive line or isGrokClient is false, it returns the original line and false.
Types ¶
type ModelEntry ¶
type ModelEntry struct {
ID string `json:"id"`
Model string `json:"model"`
Name string `json:"name"`
ContextWindow int `json:"context_window,omitempty"`
APIBackend string `json:"api_backend"`
SupportedInAPI bool `json:"supported_in_api"`
ReasoningEfforts []ReasoningEffort `json:"reasoning_efforts,omitempty"`
}
ModelEntry represents a single model entry formatted for Grok Shell.
type ReasoningEffort ¶
type ReasoningEffort struct {
Value string `json:"value"`
}
ReasoningEffort represents reasoning effort level in Grok Shell model entries.
type Response ¶
type Response struct {
Object string `json:"object"`
Data []ModelEntry `json:"data"`
}
Response represents the model list response envelope formatted for Grok Shell.
func BuildResponse ¶
BuildResponse constructs the Grok Shell formatted model list response.