claudeweb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelClaudeWeb = "claude-2"
)

Variables

This section is empty.

Functions

func ListModels

func ListModels() []string

Types

type Attachment

type Attachment struct {
	FileName         string `json:"file_name"`
	FileType         string `json:"file_type"`
	FileSize         int    `json:"file_size"`
	ExtractedContent string `json:"extracted_content"`
}

type ChatMessage

type ChatMessage struct {
	UUID         string       `json:"uuid"`
	Text         string       `json:"text"`
	Sender       string       `json:"sender"`
	Index        int          `json:"index"`
	CreatedAt    string       `json:"created_at"`
	UpdatedAt    string       `json:"updated_at"`
	EditedAt     string       `json:"edited_at"`
	ChatFeedback string       `json:"chat_feedback"`
	Attachments  []Attachment `json:"attachments"`
}

type ChatMessageResponse

type ChatMessageResponse struct {
	Completion   string `json:"completion"`
	StopReason   string `json:"stop_reason"`
	Model        string `json:"model"`
	Stop         string `json:"stop"`
	LogId        string `json:"log_id"`
	MessageLimit struct {
		Type string `json:"type"`
	} `json:"message_limit"`
}

func (*ChatMessageResponse) ToChatCompletionResponse

func (cr *ChatMessageResponse) ToChatCompletionResponse() llm.ChatCompletionResponse

func (*ChatMessageResponse) ToChatCompletionStreamResponse

func (cr *ChatMessageResponse) ToChatCompletionStreamResponse() llm.ChatCompletionStreamResponse

type ClaudeWeb

type ClaudeWeb struct {
	*llm.LLM
	// contains filtered or unexported fields
}

ClaudeWeb is a Claude request client

func New

func New(sessionKey string, dao llm.Dao) *ClaudeWeb

func (*ClaudeWeb) CreateConversation

func (c *ClaudeWeb) CreateConversation(ctx context.Context, name string) (llm.Conversation, error)

func (*ClaudeWeb) CreateMessage

func (c *ClaudeWeb) CreateMessage(ctx context.Context, conversationId string, req llm.ChatCompletionRequest) (llm.Message, error)

func (*ClaudeWeb) CreateMessageStream

func (c *ClaudeWeb) CreateMessageStream(ctx context.Context, conversationId string, req llm.ChatCompletionRequest, respChan chan llm.ChatCompletionStreamResponse, errChan chan error)

type Client

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

func NewClient

func NewClient(sessionKey string) *Client

New will return a Claude request client

func (*Client) CreateChatCompletion

func (cw *Client) CreateChatCompletion(ctx context.Context, req llm.ChatCompletionRequest) (llm.ChatCompletionResponse, error)

func (*Client) CreateChatCompletionStream

func (cw *Client) CreateChatCompletionStream(ctx context.Context, req llm.ChatCompletionRequest, dataChan chan llm.ChatCompletionStreamResponse, errChan chan error)

func (*Client) CreateChatMessage

func (cw *Client) CreateChatMessage(id, prompt string) (*ChatMessageResponse, error)

func (*Client) CreateChatMessageStream

func (cw *Client) CreateChatMessageStream(id, prompt string, streamChan chan *ChatMessageResponse, errChan chan error)

func (*Client) CreateConversation

func (cw *Client) CreateConversation(name string) (*Conversation, error)

CreateConversation is used to create conversation

func (*Client) DeleteConversation

func (cw *Client) DeleteConversation(id string) error

DeleteConversation is used to delete conversation

func (*Client) GetConversation

func (cw *Client) GetConversation(id string) (*Conversation, error)

GetConversation is used to get conversation

func (*Client) GetModel

func (cw *Client) GetModel() string

GetModel will get default model

func (*Client) GetOrgId

func (cw *Client) GetOrgId() string

GetOrgId will get organization id

func (*Client) GetOrganizations

func (cw *Client) GetOrganizations() ([]*Organization, error)

func (*Client) ListConversations

func (cw *Client) ListConversations() ([]*Conversation, error)

func (*Client) ListModels

func (cw *Client) ListModels() []string

func (*Client) UpdateConversation

func (cw *Client) UpdateConversation(id string, name string) error

UpdateConversation is used to update conversation

type Completion

type Completion struct {
	Prompt   string `json:"prompt"`
	Timezone string `json:"timezone"`
	Model    string `json:"model"`
}

type Conversation

type Conversation struct {
	UUID         string        `json:"uuid"`
	Name         string        `json:"name"`
	Summary      string        `json:"summary"`
	CreatedAt    string        `json:"created_at"`
	UpdatedAt    string        `json:"updated_at"`
	ChatMessages []ChatMessage `json:"chat_messages"`
}

func (Conversation) ToLLMConversation

func (c Conversation) ToLLMConversation() llm.Conversation

type CreateChatMessageRequest

type CreateChatMessageRequest struct {
	Completion       Completion   `json:"completion"`
	OrganizationUUID string       `json:"organization_uuid"`
	ConversationUUID string       `json:"conversation_uuid"`
	Text             string       `json:"text"`
	Attachments      []Attachment `json:"attachments"`
}

type Organization

type Organization struct {
	UUID     string `json:"uuid"`
	Name     string `json:"name"`
	Settings struct {
		ClaudeConsolePrivacy string `json:"claude_console_privacy"`
	} `json:"settings"`
	Capabilities             []string    `json:"capabilities"`
	BillableUsagePausedUntil interface{} `json:"billable_usage_paused_until"`
	CreatedAt                time.Time   `json:"created_at"`
	UpdatedAt                time.Time   `json:"updated_at"`
	ActiveFlags              []struct {
		Id          string      `json:"id"`
		Type        string      `json:"type"`
		CreatedAt   time.Time   `json:"created_at"`
		DismissedAt interface{} `json:"dismissed_at"`
		ExpiresAt   interface{} `json:"expires_at"`
	} `json:"active_flags"`
}

type Settings

type Settings struct {
	ClaudeConsolePrivacy string `json:"claude_console_privacy"`
}

type UpdateConversationRequest

type UpdateConversationRequest struct {
	OrganizationUUID string `json:"organization_uuid"`
	ConversationUUID string `json:"conversation_uuid"`
	Title            string `json:"title"`
}

Jump to

Keyboard shortcuts

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