(ctx context.Context, client chatClient, requestedModel string)
| 26 | } |
| 27 | |
| 28 | func newChatSession(ctx context.Context, client chatClient, requestedModel string) (*chatSession, error) { |
| 29 | models, err := client.ListModels(ctx) |
| 30 | if err != nil { |
| 31 | return nil, fmt.Errorf("list models: %w", err) |
| 32 | } |
| 33 | |
| 34 | model, err := resolveChatModel(requestedModel, models) |
| 35 | if err != nil { |
| 36 | return nil, err |
| 37 | } |
| 38 | |
| 39 | return &chatSession{ |
| 40 | client: client, |
| 41 | model: model, |
| 42 | models: models, |
| 43 | }, nil |
| 44 | } |
| 45 | |
| 46 | func (s *chatSession) CurrentModel() string { |
| 47 | return s.model |
no test coverage detected