MCPcopy
hub / github.com/mudler/LocalAI / newChatSession

Function newChatSession

core/cli/chat/session.go:28–44  ·  view source on GitHub ↗
(ctx context.Context, client chatClient, requestedModel string)

Source from the content-addressed store, hash-verified

26}
27
28func 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
46func (s *chatSession) CurrentModel() string {
47 return s.model

Callers 2

RunFunction · 0.85
session_test.goFile · 0.85

Calls 2

resolveChatModelFunction · 0.85
ListModelsMethod · 0.65

Tested by

no test coverage detected