( ctx context.Context, client core.Generative, content string, w io.Writer, )
| 83 | } |
| 84 | |
| 85 | func callCompletion( |
| 86 | ctx context.Context, |
| 87 | client core.Generative, |
| 88 | content string, |
| 89 | w io.Writer, |
| 90 | ) (*core.Response, error) { |
| 91 | if viper.GetBool("openai.stream") { |
| 92 | resp, err := client.CompletionStream(ctx, content, w) |
| 93 | if err != nil { |
| 94 | return nil, err |
| 95 | } |
| 96 | fmt.Fprintln(w) |
| 97 | return resp, nil |
| 98 | } |
| 99 | return client.Completion(ctx, content) |
| 100 | } |
| 101 | |
| 102 | // commitCmd represents the commit command. |
| 103 | var commitCmd = &cobra.Command{ |
no test coverage detected