schema

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Pachage schema include BaseIOSchema etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchemaToMarkdown added in v1.1.5

func SchemaToMarkdown(obj interface{}) string

SchemaToMarkdown converts a struct instance to Markdown based on `jsonschema` tags.

func Stringify added in v1.0.1

func Stringify(s Schema) string

func ToBytes added in v1.1.0

func ToBytes(s Schema) []byte

Types

type Attachement

type Attachement struct {
	// ImageURL attached image_url
	ImageURLs []string `json:"image_url,omitempty"`
	// Files attached file
	Files []io.Reader `json:"file,omitempty"`
	// FileIDs llm FileIDs
	FileIDs []string `json:"file_id,omitempty"`
}

Attachement message attachement

type Base

type Base struct {
	// contains filtered or unexported fields
}

Base is a base schema

func (Base) Attachement

func (r Base) Attachement() *Attachement

Attachement returns schema attachement

func (Base) Chunks added in v1.2.1

func (r Base) Chunks() []Schema

func (*Base) SetAttachement added in v1.0.1

func (r *Base) SetAttachement(attach *Attachement)

Attachement returns schema attachement

type Input

type Input struct {
	Base
	// ChatMessage is the chat message sent by the user to the assistant.
	ChatMessage string `json:"chat_message" jsonschema:"title=chat_message,description=The chat message sent by the user to the assistant."`
}

Input implements BaseAgentInputSchema This schema represents the input from the user to the AI agent.

func CreateInput added in v1.0.1

func CreateInput(chatMessage string) Input

CreateeInput returns a BaseAgentInput

func NewInput

func NewInput(chatMessage string) *Input

NewInput returns a new BaseAgentInput

func (Input) ToMarkdown added in v1.1.5

func (i Input) ToMarkdown() string

type Markdownable added in v1.1.5

type Markdownable interface {
	ToMarkdown() string
}

type Output

type Output struct {
	Base
	// ChatMessage is the chat message exchanged between the user and the chat agent.
	// contains the markdown-enabled response generated by the chat agent.
	ChatMessage string `` /* 199-byte string literal not displayed */
}

Output implements BaseAgentOutputSchema This schema represents the response generated by the chat agent.

func CreateOutput added in v1.0.1

func CreateOutput(chatMessage string) Output

CreateOutput returns a BaseAgentOutput

func NewOutput

func NewOutput(chatMessage string) *Output

NewOutput returns a new BaseAgentOutput

type Schema

type Schema interface {
	// Attachement() returns schema attchement
	Attachement() *Attachement
	// Chunks() returns additional schema chunks
	Chunks() []Schema
}

Schema is message schema interface

type SchemaPointer added in v1.0.8

type SchemaPointer interface {
	Schema
	SetAttachement(*Attachement)
}

type String

type String string

func (String) Attachement

func (s String) Attachement() *Attachement

func (String) Chunks added in v1.2.1

func (s String) Chunks() []Schema

func (String) SetAttachement added in v1.0.1

func (s String) SetAttachement(v *Attachement)

func (String) ToMarkdown added in v1.1.8

func (s String) ToMarkdown() string

type StructMarkdownStyle added in v1.1.5

type StructMarkdownStyle int
const (
	StructMdTitleStyle StructMarkdownStyle = iota
	StructMdListStyle
	StructMdInListStyle
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL