MCPcopy Index your code
hub / github.com/coder/coder / ListChatModels

Method ListChatModels

codersdk/chats.go:2081–2093  ·  view source on GitHub ↗

ListChatModels returns the available chat model catalog.

(ctx context.Context)

Source from the content-addressed store, hash-verified

2079
2080// ListChatModels returns the available chat model catalog.
2081func (c *ExperimentalClient) ListChatModels(ctx context.Context) (ChatModelsResponse, error) {
2082 res, err := c.Request(ctx, http.MethodGet, "/api/experimental/chats/models", nil)
2083 if err != nil {
2084 return ChatModelsResponse{}, err
2085 }
2086 defer res.Body.Close()
2087 if res.StatusCode != http.StatusOK {
2088 return ChatModelsResponse{}, ReadBodyAsError(res)
2089 }
2090
2091 var catalog ChatModelsResponse
2092 return catalog, json.NewDecoder(res.Body).Decode(&catalog)
2093}
2094
2095// ListChatProviders returns admin-managed chat provider configs.
2096func (c *ExperimentalClient) ListChatProviders(ctx context.Context) ([]ChatProviderConfig, error) {

Callers 1

TestListChatModelsFunction · 0.95

Calls 3

ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
RequestMethod · 0.45

Tested by 1

TestListChatModelsFunction · 0.76