message

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID          string                  `json:"id,omitempty"`
	Object      string                  `json:"object,omitempty"`
	CreatedAt   int                     `json:"created_at,omitempty,omitempty"`
	ThreadId    string                  `json:"thread_id,omitempty"`
	Role        string                  `json:"role"`
	Content     string                  `json:"content"`
	AssistantId string                  `json:"assistant_id,omitempty"`
	RunId       string                  `json:"run_id,omitempty"`
	Attachments []assistant.Attachments `json:"attachments,omitempty"`
	Metadata    map[string]string       `json:"metadata,omitempty"`
}

func CreateMessage

func CreateMessage(threadID, role string, content string, opts ...MessageOption) (*Message, error)

NewMessageinicializa um novo assistente, opcionalmente com um ID de assistente existente.

func RetrieveMessage

func RetrieveMessage(threadID, messageId string) (*Message, error)

func UpdateMessage

func UpdateMessage(message Message) (*Message, error)

Modifies an Thread.

type MessageCreated

type MessageCreated struct {
	Message
	Content []struct {
		Type string `json:"type"`
		Text struct {
			Value       string        `json:"value"`
			Annotations []interface{} `json:"annotations"`
		} `json:"text"`
	} `json:"content"`
}

type MessageOption

type MessageOption func(*Message)

func WithAssistantID

func WithAssistantID(assistantID string) MessageOption

WithAssistantID configura o ID do assistente associado à mensagem.

func WithAttachments

func WithAttachments(attachments []assistant.Attachments) MessageOption

WithAttachments configura os anexos da mensagem.

func WithContent

func WithContent(content string) MessageOption

WithContent configura o conteúdo da mensagem.

func WithCreatedAt

func WithCreatedAt(createdAt int) MessageOption

WithCreatedAt configura a data de criação da mensagem.

func WithMessageID

func WithMessageID(id string) MessageOption

WithMessageID configura o ID da mensagem.

func WithMetadata

func WithMetadata(metadata map[string]string) MessageOption

WithMetadata configura os metadados da mensagem.

func WithObject

func WithObject(object string) MessageOption

WithObject configura o tipo de objeto da mensagem.

func WithRole

func WithRole(role string) MessageOption

WithRole configura o papel (role) da mensagem.

func WithRunID

func WithRunID(runID string) MessageOption

WithRunID configura o ID da execução da mensagem.

func WithThreadID

func WithThreadID(threadID string) MessageOption

WithThreadID configura o ID da thread da mensagem.

type Response

type Response struct {
	ID      string           `json:"ID"`
	Object  string           `json:"object"`
	Data    []MessageCreated `json:"data"`
	FirstId string           `json:"first_id,omitempty"`
	LastId  string           `json:"last_id,omitempty"`
	HasMore bool             `json:"has_more,omitempty"`
	Deleted bool             `json:"deleted,omitempty"`
}

func DeleteMessage

func DeleteMessage(threadID, messageId string) (*Response, error)

Delete an Thread.

func ListMessages

func ListMessages(threadID string) (*Response, error)

Returns a list of messages for a given thread.

Jump to

Keyboard shortcuts

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