utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedIPRanges = []string{
	"160.79.104.0/23",
	"2607:6bc0::/48",
}

AllowedIPRanges are the IP ranges that Anthropics services live on.

View Source
var SupportedRegions = []string{}/* 159 elements not displayed */

List of supported regions by the Anthropics API.

Functions

func GetChatPrompt

func GetChatPrompt(chat []Message) (string, error)

GetChatPrompt constructs a prompt string from a series of messages in a chat conversation.

func GetPrompt

func GetPrompt(userQuestion string) (string, error)

GetPrompt returns a prompt string that can be used to complete a user question.

func IsIPAllowed

func IsIPAllowed(ipStr string) (bool, error)

IsIPAllowed checks if the provided IP address is within the allowed IP ranges.

func IsRegionSupported

func IsRegionSupported(region string) bool

IsRegionSupported checks if the provided region is supported by the Anthropics API.

Types

type Message

type Message struct {
	Sender  string // The sender's name (e.g., "Human" or a username)
	Content string // The content of the message
}

Message represents a single message in a chat conversation.

Jump to

Keyboard shortcuts

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