NewTextContentPart (llm/types.go)

initializ/forge · forge-core/llm/types.go · go · Apache-2.0
ai

Package llm provides canonical types for LLM chat interactions. These types are provider-agnostic; each provider translates to/from its native API format.

// Source: https://github.com/initializ/forge | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Package llm provides canonical types for LLM chat interactions.
// These types are provider-agnostic; each provider translates to/from
// its native API format.
package llm

import "encoding/json"

// Role constants for chat messages.
const (
	RoleSystem    = "system"
	RoleUser      = "user"
	RoleAssistant = "assistant"
	RoleTool      = "tool"
)

// ChatMessage represents a single message in a chat conversation.
//
// Content is the flattened text-of-record and stays authoritative for
// compression, truncation, dedup, and the security scanners. Parts is the
// additive multimodal repr

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key