feat: add NeedsRawMode method to AI vendor interface

## CHANGES

- Add NeedsRawMode to Vendor interface
- Implement NeedsRawMode in all AI clients
- Return false for all implementations
- Support model-specific raw mode detection
- Enable future raw mode requirements
This commit is contained in:
Kayvan Sylvan
2025-05-22 16:41:12 -07:00
parent 0a4950dd08
commit 39a8b67438
9 changed files with 33 additions and 0 deletions

View File

@@ -205,3 +205,7 @@ func (an *Client) toMessages(msgs []*goopenai.ChatCompletionMessage) (ret []anth
return anthropicMessages
}
func (an *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -41,3 +41,7 @@ func (oi *Client) ListModels() (ret []string, err error) {
ret = oi.apiDeployments
return
}
func (oi *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -90,3 +90,7 @@ func (c *Client) Setup() error {
func (c *Client) SetupFillEnvFileContent(_ *bytes.Buffer) {
// No environment variables needed for dry run
}
func (c *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -43,3 +43,7 @@ func (oi *Client) ListModels() (ret []string, err error) {
ret = oi.apiModels
return
}
func (oi *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -143,6 +143,10 @@ func (o *Client) extractText(response *genai.GenerateContentResponse) (ret strin
return
}
func (o *Client) NeedsRawMode(modelName string) bool {
return false
}
func toMessages(msgs []*goopenai.ChatCompletionMessage) (systemInstruction *genai.Content, messages []genai.Part) {
if len(msgs) >= 2 {
systemInstruction = &genai.Content{

View File

@@ -345,3 +345,7 @@ func (c *Client) GetEmbeddings(ctx context.Context, input string, opts *common.C
embeddings = result.Data[0].Embedding
return
}
func (c *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -138,3 +138,7 @@ func (o *Client) createChatRequest(msgs []*goopenai.ChatCompletionMessage, opts
}
return
}
func (o *Client) NeedsRawMode(modelName string) bool {
return false
}

View File

@@ -123,6 +123,10 @@ func (o *Client) Send(ctx context.Context, msgs []*goopenai.ChatCompletionMessag
return
}
func (o *Client) NeedsRawMode(modelName string) bool {
return false
}
func (o *Client) buildChatCompletionRequest(
inputMsgs []*goopenai.ChatCompletionMessage, opts *common.ChatOptions,
) (ret goopenai.ChatCompletionRequest) {

View File

@@ -14,4 +14,5 @@ type Vendor interface {
ListModels() ([]string, error)
SendStream([]*goopenai.ChatCompletionMessage, *common.ChatOptions, chan string) error
Send(context.Context, []*goopenai.ChatCompletionMessage, *common.ChatOptions) (string, error)
NeedsRawMode(modelName string) bool
}