Documentation
¶
Index ¶
- func BuildSystemPrompt(workspaceDir string, files []string) (string, error)
- func CreateAgent(ctx context.Context, cfg Config, systemPrompt string, ...) (fantasy.Agent, fantasy.LanguageModel, error)
- type Config
- type Service
- func (s *Service) Chat(ctx context.Context, sessionID, prompt string) (string, error)
- func (s *Service) ChatStream(ctx context.Context, sessionID, prompt string, cb StreamCallback) (string, error)
- func (s *Service) DeleteSession(ctx context.Context, sessionID string) error
- func (s *Service) ListSessionMessages(ctx context.Context, sessionID string, _ int) ([]SessionMessage, error)
- func (s *Service) ListSessions(ctx context.Context) ([]memory.SessionInfo, error)
- func (s *Service) PromptObject(ctx context.Context, prompt string, schemaJSON []byte, ...) ([]byte, string, error)
- type SessionMessage
- type StreamCallback
- type StreamEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ChatStream ¶
func (*Service) DeleteSession ¶
func (*Service) ListSessionMessages ¶
func (s *Service) ListSessionMessages(ctx context.Context, sessionID string, _ int) ([]SessionMessage, error)
ListSessionMessages returns the recent messages stored for sessionID in role/content form suitable for gRPC transport. limit <= 0 means "use the store default" (LIMIT 50 today).
func (*Service) ListSessions ¶
func (*Service) PromptObject ¶
func (s *Service) PromptObject( ctx context.Context, prompt string, schemaJSON []byte, schemaName, schemaDesc string, ) ([]byte, string, error)
PromptObject runs a one-shot, stateless structured-output query against the underlying LanguageModel. No session memory is loaded or saved, no tool loop is run — just prompt + schema in, parsed object out. Matches fantasy.LanguageModel.GenerateObject one-to-one and exists so the runtime's gRPC surface has a place to hang the call without exposing the model type through Service's public API.
schemaJSON must be a JSON Schema document that unmarshals into fantasy/schema.Schema (common subset: type, properties, required, items, enum, format, min/max). schemaName and schemaDesc surface in tool-mode providers as the synthetic tool's name/description.
ObjectMode (JSON / tool / text / auto) is provider-level — set when the LanguageModel is constructed via e.g. anthropic.WithObjectMode(...). This method doesn't override it per-call because fantasy.ObjectCall has no per-call mode field.
Returns (objectJSON, rawText). rawText is the model's unparsed reply — useful for debugging when repair was needed.
type SessionMessage ¶
SessionMessage is the plain wire-ready view of a stored chat message: role, text, and its creation time. Compacted or summarised entries already flow through the store as role=assistant, so callers get a post-compaction view.
type StreamCallback ¶
type StreamCallback func(event StreamEvent)