 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- func IsCloudAIRequest(opts *wshrpc.OpenAIOptsType) bool
- func MakeOpenAIPacket() *wshrpc.OpenAIPacketType
- func RunAICommand(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
- type AIBackend
- type AnthropicBackend
- type OpenAIBackend
- type OpenAICloudReqPacketType
- type OpenAICmdInfoChatMessage
- type OpenAICmdInfoPacketOutputType
- type WaveAICloudBackend
Constants ¶
      View Source
      
  
    const ApiType_Anthropic = "anthropic"
    
      View Source
      
  
    const CloudWebsocketConnectTimeout = 1 * time.Minute
    
      View Source
      
  
    const DefaultAzureAPIVersion = "2023-05-15"
    
      View Source
      
  
    const DefaultMaxTokens = 2048
    
      View Source
      
  
    const DefaultModel = "gpt-4o-mini"
    
      View Source
      
  
    const OpenAICloudReqStr = "openai-cloudreq"
    
      View Source
      
  
    const OpenAIPacketStr = "openai"
    
      View Source
      
  
    const PacketEOFStr = "EOF"
    
      View Source
      
  
    const WCloudWSEndpoint = "wss://wsapi.waveterm.dev/"
    
      View Source
      
  
const WCloudWSEndpointVarName = "WCLOUD_WS_ENDPOINT"
    Variables ¶
This section is empty.
Functions ¶
func IsCloudAIRequest ¶ added in v0.8.10
func IsCloudAIRequest(opts *wshrpc.OpenAIOptsType) bool
func MakeOpenAIPacket ¶
func MakeOpenAIPacket() *wshrpc.OpenAIPacketType
func RunAICommand ¶ added in v0.8.10
func RunAICommand(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
Types ¶
type AIBackend ¶ added in v0.9.2
type AIBackend interface {
	StreamCompletion(
		ctx context.Context,
		request wshrpc.OpenAiStreamRequest,
	) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
}
    type AnthropicBackend ¶ added in v0.9.2
type AnthropicBackend struct{}
    func (AnthropicBackend) StreamCompletion ¶ added in v0.9.2
func (AnthropicBackend) StreamCompletion(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
type OpenAIBackend ¶ added in v0.9.2
type OpenAIBackend struct{}
    func (OpenAIBackend) StreamCompletion ¶ added in v0.9.2
func (OpenAIBackend) StreamCompletion(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
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 WaveAICloudBackend ¶ added in v0.9.2
type WaveAICloudBackend struct{}
    func (WaveAICloudBackend) StreamCompletion ¶ added in v0.9.2
func (WaveAICloudBackend) StreamCompletion(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType]
 Click to show internal directories. 
   Click to hide internal directories.