GetChatFile retrieves a previously uploaded chat file by ID.
(ctx context.Context, fileID uuid.UUID)
| 3295 | |
| 3296 | // GetChatFile retrieves a previously uploaded chat file by ID. |
| 3297 | func (c *ExperimentalClient) GetChatFile(ctx context.Context, fileID uuid.UUID) ([]byte, string, error) { |
| 3298 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/experimental/chats/files/%s", fileID), nil) |
| 3299 | if err != nil { |
| 3300 | return nil, "", err |
| 3301 | } |
| 3302 | defer res.Body.Close() |
| 3303 | if res.StatusCode != http.StatusOK { |
| 3304 | return nil, "", ReadBodyAsError(res) |
| 3305 | } |
| 3306 | data, err := io.ReadAll(res.Body) |
| 3307 | if err != nil { |
| 3308 | return nil, "", err |
| 3309 | } |
| 3310 | return data, res.Header.Get("Content-Type"), nil |
| 3311 | } |
| 3312 | |
| 3313 | // GetChatUsageLimitConfig returns the deployment-wide chat usage limit config. |
| 3314 | func (c *ExperimentalClient) GetChatUsageLimitConfig(ctx context.Context) (ChatUsageLimitConfigResponse, error) { |