Documentation
¶
Index ¶
- Constants
- func AggregateModelUsage(aggregateModelUsage *aipb.ModelUsage, modelUsages ...*aipb.ModelUsage)
- func ExtractJSONString(content string) (string, error)
- func FilterBlocks(blocks []*aipb.Block, blockTypes ...BlockType) []*aipb.Block
- func IsModelUsageEmpty(modelUsage *aipb.ModelUsage) bool
- func ModelUsageCost(modelUsage *aipb.ModelUsage) float64
- func NewAssistantMessage(blocks ...*aipb.Block) *aipb.Message
- func NewErrorToolResult(toolName, toolCallID string, err error) *aipb.ToolResult
- func NewImageBlock(image *aipb.Image) *aipb.Block
- func NewImageFromData(data []byte, mediaType string) *aipb.Image
- func NewImageFromURL(url string) *aipb.Image
- func NewResourceConsumption(quantity int32) *aipb.ResourceConsumption
- func NewStructuredToolResult(toolName, toolCallID string, content *structpb.Value) *aipb.ToolResult
- func NewSystemMessage(blocks ...*aipb.Block) *aipb.Message
- func NewTextBlock(text string) *aipb.Block
- func NewThoughtBlock(thought string) *aipb.Block
- func NewToolCallBlock(toolCall *aipb.ToolCall) *aipb.Block
- func NewToolMessage(blocks ...*aipb.Block) *aipb.Message
- func NewToolResult(toolName, toolCallID, content string) *aipb.ToolResult
- func NewToolResultBlock(toolResult *aipb.ToolResult) *aipb.Block
- func NewUserMessage(blocks ...*aipb.Block) *aipb.Message
- func ParseToolResult(toolResult *aipb.ToolResult) (string, error)
- func SetModelUsagePrices(usage *aipb.ModelUsage, pricing *aipb.TttModelPricing)
- type BlockType
- type MessageAccumulator
Constants ¶
View Source
const ( // Tool call arguments could not be unmarshaled from JSON. ErrorInfoReasonToolCallArgumentUnmarshal = "TOOL_CALL_ARGUMENT_UNMARSHAL" // Tool call references a tool that was not provided in the request. ErrorInfoReasonToolCallUnknownTool = "TOOL_CALL_UNKNOWN_TOOL" )
Variables ¶
This section is empty.
Functions ¶
func AggregateModelUsage ¶
func AggregateModelUsage(aggregateModelUsage *aipb.ModelUsage, modelUsages ...*aipb.ModelUsage)
func ExtractJSONString ¶
ExtractJSONString finds and extracts the first JSON object from LLM output
func IsModelUsageEmpty ¶
func IsModelUsageEmpty(modelUsage *aipb.ModelUsage) bool
func ModelUsageCost ¶
func ModelUsageCost(modelUsage *aipb.ModelUsage) float64
func NewErrorToolResult ¶
func NewErrorToolResult(toolName, toolCallID string, err error) *aipb.ToolResult
func NewImageFromURL ¶
func NewResourceConsumption ¶
func NewResourceConsumption(quantity int32) *aipb.ResourceConsumption
func NewStructuredToolResult ¶
func NewStructuredToolResult(toolName, toolCallID string, content *structpb.Value) *aipb.ToolResult
func NewTextBlock ¶
func NewThoughtBlock ¶
func NewToolResult ¶
func NewToolResult(toolName, toolCallID, content string) *aipb.ToolResult
func NewToolResultBlock ¶
func NewToolResultBlock(toolResult *aipb.ToolResult) *aipb.Block
func ParseToolResult ¶
func ParseToolResult(toolResult *aipb.ToolResult) (string, error)
func SetModelUsagePrices ¶
func SetModelUsagePrices(usage *aipb.ModelUsage, pricing *aipb.TttModelPricing)
Types ¶
type MessageAccumulator ¶
type MessageAccumulator struct {
Message *aipb.Message
StopReason pb.StopReason
ModelUsage *aipb.ModelUsage
GenerationMetrics *aipb.GenerationMetrics
// contains filtered or unexported fields
}
MessageAccumulator accumulates StreamMessage events into a complete message.
func NewMessageAccumulator ¶
func NewMessageAccumulator() *MessageAccumulator
func (*MessageAccumulator) Add ¶
func (a *MessageAccumulator) Add(response *pb.StreamGenerateMessageResponse) error
Directories
¶
| Path | Synopsis |
|---|---|
|
provider/mock
Package mock implements a scriptable in-process AI provider for system acceptance tests.
|
Package mock implements a scriptable in-process AI provider for system acceptance tests. |
|
Code generated by protoc-gen-api.
|
Code generated by protoc-gen-api. |
Click to show internal directories.
Click to hide internal directories.