( ctx context.Context, systemPrompt string, messages []map[string]any, tools []map[string]any, options *LLMRequestOptions, )
| 642 | func (c *OpenAICompatibleClient) buildMessages(systemPrompt string, messages []map[string]any) []map[string]any { |
| 643 | converted := convertAnthropicMessagesToOpenAI(messages) |
| 644 | result := make([]map[string]any, 0, len(converted)+1) |
| 645 | |
| 646 | if systemPrompt != "" { |
| 647 | result = append(result, map[string]any{ |
| 648 | "role": "system", |
| 649 | "content": systemPrompt, |
| 650 | }) |
| 651 | } |
| 652 | |
| 653 | result = append(result, converted...) |
| 654 | return result |
| 655 | } |
| 656 | |
| 657 | func (c *OpenAICompatibleClient) Complete( |
| 658 | ctx context.Context, |
| 659 | systemPrompt string, |
| 660 | messages []map[string]any, |
| 661 | opts CompleteOptions, |
| 662 | ) (string, error) { |
| 663 | response, err := collectCompletionStream(c.StreamChat(ctx, systemPrompt, messages, opts.Tools, |
| 664 | &LLMRequestOptions{MaxTokens: opts.MaxTokens, Temperature: opts.Temperature})) |
| 665 | if err != nil { |
| 666 | return "", err |
| 667 | } |
| 668 | return response.Text, nil |
| 669 | } |
| 670 | |
| 671 | func (c *OpenAICompatibleClient) CompleteStructured( |
| 672 | ctx context.Context, |
| 673 | systemPrompt string, |
| 674 | messages []map[string]any, |
| 675 | opts StructuredCompletionOptions, |
| 676 | ) (Response, error) { |
| 677 | return collectCompletionStream(c.StreamChat(ctx, systemPrompt, messages, opts.Tools, &LLMRequestOptions{ |
| 678 | MaxTokens: opts.MaxTokens, RequiredTool: opts.RequiredTool, DisableThinking: opts.DisableThinking, |
| 679 | Temperature: opts.Temperature, |
| 680 | })) |
| 681 | } |
nothing calls this directly
no test coverage detected