 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- func ConvertPrompt(prompt []wshrpc.OpenAIPromptMessageType) []openaiapi.ChatCompletionMessage
- func CreateErrorPacket(errStr string) *wshrpc.OpenAIPacketType
- func CreateTextPacket(text string) *wshrpc.OpenAIPacketType
- func GetWSEndpoint() string
- func MakeOpenAIPacket() *wshrpc.OpenAIPacketType
- func RunCloudCompletionStream(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
- func RunLocalCompletionStream(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
- type OpenAICloudReqPacketType
- type OpenAICmdInfoChatMessage
- type OpenAICmdInfoPacketOutputType
- type OpenAIOptsType
Constants ¶
      View Source
      
  
    const CloudWebsocketConnectTimeout = 1 * time.Minute
    
      View Source
      
  
    const DefaultMaxTokens = 1000
    
      View Source
      
  
    const DefaultModel = "gpt-4o-mini"
    
      View Source
      
  
    const DefaultStreamChanSize = 10
    
      View Source
      
  
    const OpenAICloudReqStr = "openai-cloudreq"
    
      View Source
      
  
    const OpenAIPacketStr = "openai"
    
      View Source
      
  
    const PCloudWSEndpoint = "wss://wsapi.waveterm.dev/"
    
      View Source
      
  
    const PCloudWSEndpointVarName = "PCLOUD_WS_ENDPOINT"
    
      View Source
      
  
const PacketEOFStr = "EOF"
    Variables ¶
This section is empty.
Functions ¶
func ConvertPrompt ¶
func ConvertPrompt(prompt []wshrpc.OpenAIPromptMessageType) []openaiapi.ChatCompletionMessage
func CreateErrorPacket ¶
func CreateErrorPacket(errStr string) *wshrpc.OpenAIPacketType
func CreateTextPacket ¶
func CreateTextPacket(text string) *wshrpc.OpenAIPacketType
func GetWSEndpoint ¶
func GetWSEndpoint() string
func MakeOpenAIPacket ¶
func MakeOpenAIPacket() *wshrpc.OpenAIPacketType
func RunCloudCompletionStream ¶
func RunCloudCompletionStream(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
func RunLocalCompletionStream ¶
func RunLocalCompletionStream(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
Types ¶
type OpenAICloudReqPacketType ¶
type OpenAICloudReqPacketType struct {
	Type       string                           `json:"type"`
	ClientId   string                           `json:"clientid"`
	Prompt     []wshrpc.OpenAIPromptMessageType `json:"prompt"`
	MaxTokens  int                              `json:"maxtokens,omitempty"`
	MaxChoices int                              `json:"maxchoices,omitempty"`
}
    func MakeOpenAICloudReqPacket ¶
func MakeOpenAICloudReqPacket() *OpenAICloudReqPacketType
type OpenAICmdInfoChatMessage ¶
type OpenAICmdInfoChatMessage struct {
	MessageID           int                            `json:"messageid"`
	IsAssistantResponse bool                           `json:"isassistantresponse,omitempty"`
	AssistantResponse   *OpenAICmdInfoPacketOutputType `json:"assistantresponse,omitempty"`
	UserQuery           string                         `json:"userquery,omitempty"`
	UserEngineeredQuery string                         `json:"userengineeredquery,omitempty"`
}
    type OpenAIOptsType ¶
 Click to show internal directories. 
   Click to hide internal directories.