claude

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsClaudeEngine

func IsClaudeEngine(engine string) bool

Types

type Client

type Client struct {
	APIKey     string
	APIVersion string
	// contains filtered or unexported fields
}

Client represents the Claude API client.

func NewClient

func NewClient(apiKey string, apiVersion ...string) *Client

NewClient initializes and returns a new API client.

func (*Client) Complete

func (c *Client) Complete(req *Request) (*SuccessfulResponse, error)

Complete sends a completion request and returns the response.

func (*Client) StreamComplete

func (c *Client) StreamComplete(req *Request) (<-chan Event, error)

type ErrorDetail

type ErrorDetail struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

ErrorDetail contains error details.

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

ErrorResponse represents the API's error response.

type Event

type Event struct {
	Data  string
	Event string
	ID    string
	Retry int
}

Event represents a server-sent event.

type Metadata

type Metadata struct {
}

Metadata represents the metadata object.

type Request

type Request struct {
	Model             string    `json:"model"`
	Prompt            string    `json:"prompt"`
	MaxTokensToSample int       `json:"max_tokens_to_sample"`
	StopSequences     []string  `json:"stop_sequences,omitempty"`
	Temperature       *float64  `json:"temperature,omitempty"`
	TopP              *float64  `json:"top_p,omitempty"`
	TopK              *int      `json:"top_k,omitempty"`
	Metadata          *Metadata `json:"metadata,omitempty"`
	Stream            bool      `json:"stream"`
}

Request represents the completion request payload.

type Step

type Step struct {
	Settings *settings.StepSettings
}

func (*Step) Close

func (csf *Step) Close(ctx context.Context) error

Close is only called after the returned monad has been entirely consumed

func (*Step) SetStreaming

func (csf *Step) SetStreaming(b bool)

func (*Step) Start

func (csf *Step) Start(
	ctx context.Context,
	messages []*geppetto_context.Message,
) (*steps.StepResult[string], error)

type SuccessfulResponse

type SuccessfulResponse struct {
	Completion string `json:"completion"`
	StopReason string `json:"stop_reason"`
	Model      string `json:"model"`
}

SuccessfulResponse represents the API's successful response.

Jump to

Keyboard shortcuts

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