Skip to content

Commit

Permalink
fix: api
Browse files Browse the repository at this point in the history
  • Loading branch information
jueli12 committed Aug 25, 2024
1 parent 1c7ae79 commit c2085c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions pkg/infra/ai/azureopenai.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,10 @@ func (c *AzureAIClient) Configure(cfg AIConfig) error {
return nil
}

func (c *AzureAIClient) Generate(ctx context.Context, prompt string, serviceType string) (string, error) {
servicePrompt := ServicePromptMap[serviceType]

func (c *AzureAIClient) Generate(ctx context.Context, prompt string) (string, error) {
resp, err := c.client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: c.model,
Messages: []openai.ChatCompletionMessage{
{
Role: openai.ChatMessageRoleSystem,
Content: servicePrompt,
},
{
Role: openai.ChatMessageRoleUser,
Content: prompt,
Expand Down
8 changes: 1 addition & 7 deletions pkg/infra/ai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@ func (c *OpenAIClient) Configure(cfg AIConfig) error {
return nil
}

func (c *OpenAIClient) Generate(ctx context.Context, prompt string, serviceType string) (string, error) {
servicePrompt := ServicePromptMap[serviceType]

func (c *OpenAIClient) Generate(ctx context.Context, prompt string) (string, error) {
resp, err := c.client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: c.model,
Messages: []openai.ChatCompletionMessage{
{
Role: openai.ChatMessageRoleSystem,
Content: servicePrompt,
},
{
Role: openai.ChatMessageRoleUser,
Content: prompt,
Expand Down

0 comments on commit c2085c0

Please sign in to comment.