Documentation
¶
Index ¶
- Constants
- Variables
- func AnthropicToolResultContent(result *anthropic.ToolResultBlockParam) string
- func BedrockToolResultContent(content []brtypes.ToolResultContentBlock) string
- func EstimateAnthropic(messages []anthropic.MessageParam) int
- func EstimateBedrock(messages []brtypes.Message) int
- func EstimateGenkit(messages []*ai.Message) int
- func EstimateOpenAI(messages []openai.ChatCompletionMessageParamUnion) int
- func EstimateResponses(input []responses.ResponseInputItemUnionParam) int
- func OpenAIToolContent(content openai.ChatCompletionToolMessageParamContentUnion) string
- func ResponsesToolOutputContent(output responses.ResponseInputItemFunctionCallOutputOutputUnionParam) (string, bool)
- type Reduction
- func ReduceAnthropic(window int, messages []anthropic.MessageParam) ([]anthropic.MessageParam, Reduction)
- func ReduceBedrock(window int, messages []brtypes.Message) ([]brtypes.Message, Reduction)
- func ReduceGenkit(window int, messages []*ai.Message) ([]*ai.Message, Reduction)
- func ReduceOpenAI(window int, messages []openai.ChatCompletionMessageParamUnion) ([]openai.ChatCompletionMessageParamUnion, Reduction)
- func ReduceResponses(window int, input []responses.ResponseInputItemUnionParam) ([]responses.ResponseInputItemUnionParam, Reduction)
Constants ¶
View Source
const ContextWindowExceededError = "context exceeds model window after removing tool results"
View Source
const RemovedToolResultPlaceholder = "Tool result removed to fit context."
Variables ¶
View Source
var ErrContextWindowExceeded = errors.New("context window exceeded")
Functions ¶
func AnthropicToolResultContent ¶
func AnthropicToolResultContent(result *anthropic.ToolResultBlockParam) string
func BedrockToolResultContent ¶
func BedrockToolResultContent(content []brtypes.ToolResultContentBlock) string
func EstimateAnthropic ¶
func EstimateAnthropic(messages []anthropic.MessageParam) int
func EstimateBedrock ¶
func EstimateGenkit ¶
func EstimateOpenAI ¶
func EstimateOpenAI(messages []openai.ChatCompletionMessageParamUnion) int
func EstimateResponses ¶
func EstimateResponses(input []responses.ResponseInputItemUnionParam) int
func OpenAIToolContent ¶
func OpenAIToolContent(content openai.ChatCompletionToolMessageParamContentUnion) string
func ResponsesToolOutputContent ¶
func ResponsesToolOutputContent(output responses.ResponseInputItemFunctionCallOutputOutputUnionParam) (string, bool)
Types ¶
type Reduction ¶
type Reduction struct {
OriginalTokenCount int
ReducedTokenCount int
RemovedToolResults int
FitsBudget bool
}
func ReduceAnthropic ¶
func ReduceAnthropic(window int, messages []anthropic.MessageParam) ([]anthropic.MessageParam, Reduction)
func ReduceBedrock ¶
func ReduceGenkit ¶
func ReduceOpenAI ¶
func ReduceOpenAI(window int, messages []openai.ChatCompletionMessageParamUnion) ([]openai.ChatCompletionMessageParamUnion, Reduction)
func ReduceResponses ¶
func ReduceResponses(window int, input []responses.ResponseInputItemUnionParam) ([]responses.ResponseInputItemUnionParam, Reduction)
Click to show internal directories.
Click to hide internal directories.