Skip to content

Commit b75ab59

Browse files
Fixed bug in list models
1 parent bf0699d commit b75ab59

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ promptsLibraryDir: <directory to load prompts, defaults to $HOME/prompts-library
4242
You will need to install the gcloud sdk before using VertexAI.
4343
You will need a project on Google Cloud which gives your user access to Vertex AI.
4444
45+
You need to login with:
46+
`gcloud auth login`
47+
48+
Before using.
49+
4550
### Sample configuration
4651

4752
```yaml

client/openai/openaiclient.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func (c *OpenAiClient) Models(models chan<- client.LanguageModel) error {
109109
for _, languageModel := range response.Data {
110110
models <- languageModel
111111
}
112+
113+
close(models)
114+
112115
return nil
113116
}
114117

cmd/listModels.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ var listModelsCmd = &cobra.Command{
2929
f := bufio.NewWriter(os.Stdout)
3030
defer f.Flush()
3131
models := make(chan client.LanguageModel)
32-
err := chatGPT.Models(models)
32+
var err error
33+
go func() {
34+
err = chatGPT.Models(models)
35+
}()
3336
for model := range models {
3437
fmt.Fprintln(os.Stdout, model)
3538
}

0 commit comments

Comments
 (0)