Documentation
¶
Index ¶
- Variables
- func DecodeJSONWithExtra(c *gin.Context, dst any, knownKeys ...string) (map[string]any, error)
- func Flush(c *gin.Context) error
- func WriteJSONLine(c *gin.Context, payload any) error
- func WriteSSEData(c *gin.Context, event, data string) error
- func WriteSSEJSON(c *gin.Context, event string, payload any) error
- type Converter
- type Options
- type Protocol
- type Registry
- type RouteSpec
- type SSEMessage
- type SSEReader
- type StreamReader
- type StreamWriter
Constants ¶
This section is empty.
Variables ¶
var ( DecodeJSONWithExtraFromBody = core.DecodeJSONWithExtraFromBody DecodeStreamJSON = core.DecodeStreamJSON JSONRequest = core.JSONRequest MergeJSONPayload = core.MergeJSONPayload NormalizeRequestForConversion = core.NormalizeRequestForConversion NormalizeRequestForConversionWithWarnings = core.NormalizeRequestForConversionWithWarnings NormalizeToolCallFinish = core.NormalizeToolCallFinish ResponsesTextFromChatResponseFormat = core.ResponsesTextFromChatResponseFormat ResponsesReasoningFromChatReasoningEffort = core.ResponsesReasoningFromChatReasoningEffort ChatReasoningEffortFromResponsesReasoning = core.ChatReasoningEffortFromResponsesReasoning ResponsesTextWithVerbosity = core.ResponsesTextWithVerbosity VerbosityFromResponsesText = core.VerbosityFromResponsesText ChatResponseFormatFromResponsesText = core.ChatResponseFormatFromResponsesText ResponsesTextFromOllamaFormat = core.ResponsesTextFromOllamaFormat OllamaFormatFromResponsesText = core.OllamaFormatFromResponsesText StopAsSequences = core.StopAsSequences JoinURL = core.JoinURL ImageAsDataURI = core.ImageAsDataURI ParseImageURL = core.ParseImageURL ParseDataURI = core.ParseDataURI ResolveImageData = core.ResolveImageData RawFromObject = core.RawFromObject RawToObject = core.RawToObject RawToJSONString = core.RawToJSONString DefaultToolParameters = core.DefaultToolParameters TextFromParts = core.TextFromParts FirstText = core.FirstText AppendSystem = core.AppendSystem MapFinishFromOpenAI = core.MapFinishFromOpenAI MapFinishToOpenAI = core.MapFinishToOpenAI MapFinishFromClaude = core.MapFinishFromClaude MapFinishToClaude = core.MapFinishToClaude MapFinishFromGemini = core.MapFinishFromGemini MapFinishToGemini = core.MapFinishToGemini GeminiModelPath = core.GeminiModelPath ResponseID = core.ResponseID IsStandardUsageField = core.IsStandardUsageField )
var ( NewSSEReader = core.NewSSEReader WriteSSEJSONTo = core.WriteSSEJSONTo WriteSSEDataTo = core.WriteSSEDataTo WriteJSONLineTo = core.WriteJSONLineTo )
Functions ¶
func DecodeJSONWithExtra ¶
DecodeJSONWithExtra reads the request body from a gin context and decodes it into dst, returning the unknown keys as an extra map. This is the only gin-aware helper; everything else is gin-free and lives in protocolcore.
func Flush ¶
Flush flushes the gin response writer when the underlying writer supports flushing. SSE/NDJSON writers depend on this.
Types ¶
type Converter ¶
Converter is the gin-free protocol interface for format conversion. It is used by pkg/modelbridge to avoid importing gin.
type Protocol ¶
type Protocol interface {
Name() string
Route() RouteSpec
DecodeRequest(c *gin.Context) (*ir.Request, error)
WriteResponse(c *gin.Context, r *ir.Response) error
NewStreamWriter(c *gin.Context) StreamWriter
BuildHTTPRequest(ctx context.Context, baseURL, token string, r *ir.Request) (*http.Request, error)
DecodeResponse(body []byte) (*ir.Response, error)
NewStreamReader(resp *http.Response) StreamReader
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
type SSEMessage ¶
type SSEMessage = core.SSEMessage
Aliases re-export the gin-free SSE primitives from protocolcore so existing callers under internal/protocol can keep using these names. The actual implementation lives in protocolcore.
type SSEReader ¶
Aliases re-export the gin-free SSE primitives from protocolcore so existing callers under internal/protocol can keep using these names. The actual implementation lives in protocolcore.
type StreamReader ¶
type StreamReader = core.StreamReader
type StreamWriter ¶
type StreamWriter = core.StreamWriter
Source Files
¶
- helpers.go
- protocol.go
- registry.go
- sse.go