Group A — gap fills: - restore Client.GetWorkflowWorkerInfo (regression from v1.3.0; /v1/workflows/workers/whoami is still in the spec and is needed by callers running custom workers) - add Client.GetChatCompletionFields, GetChatCompletionFieldOptions, GetChatCompletionFieldOptionsCounts (previously-missing observability fields API) Group B — Python SDK v2.3.0..v2.4.3 sync: - workflow.EncodedPayloadOption typed enum (offloaded / encrypted / encrypted-partial); replaces []string on NetworkEncodedInput.EncodingOptions. Wire-compatible refinement; source-incompatible for callers that built the slice as []string literals. - workflow-connector integration: ConnectorSlot, ConnectorBindings, ConnectorExtensions, WorkflowExtensions, BuildConnectorExtensions(...) helper, ConnectorAuthTaskState, ConnectorAuthStatus constants. New Extensions map[string]any field on workflow.ExecutionRequest. - HITL confirmation constants: conversation.Confirmation enum (ConfirmationAllow/Deny) and ConfirmationStatusPending/Allowed/Denied alongside the pre-existing ToolCallConfirmation type and tool_confirmations field. No-op verification: - ChatCompletionChoice.message remains singular per spec v1.0.0; Python's 'messages[]' rename was internal SDK shape, not wire format. Tests: 297 (was 284), all green. go vet clean.
47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package mistral
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net/url"
|
|
|
|
"github.com/VikingOwl91/mistral-go-sdk/observability"
|
|
)
|
|
|
|
// GetChatCompletionFields returns the searchable field definitions and groups
|
|
// for chat-completion observability events.
|
|
func (c *Client) GetChatCompletionFields(ctx context.Context) (*observability.ChatCompletionFields, error) {
|
|
var resp observability.ChatCompletionFields
|
|
if err := c.doJSON(ctx, "GET", "/v1/observability/chat-completion-fields", nil, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
// GetChatCompletionFieldOptions returns the distinct values seen for the given
|
|
// field, filtered by the requested operator.
|
|
func (c *Client) GetChatCompletionFieldOptions(ctx context.Context, fieldName string, operator observability.FieldOperator) (*observability.ChatCompletionFieldOptions, error) {
|
|
q := url.Values{}
|
|
q.Set("operator", string(operator))
|
|
path := fmt.Sprintf("/v1/observability/chat-completion-fields/%s/options?%s", url.PathEscape(fieldName), q.Encode())
|
|
var resp observability.ChatCompletionFieldOptions
|
|
if err := c.doJSON(ctx, "GET", path, nil, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
// GetChatCompletionFieldOptionsCounts returns per-value event counts for the
|
|
// given field, optionally filtered by the supplied filter payload.
|
|
func (c *Client) GetChatCompletionFieldOptionsCounts(ctx context.Context, fieldName string, req *observability.FieldOptionCountsRequest) (*observability.FieldOptionCounts, error) {
|
|
if req == nil {
|
|
req = &observability.FieldOptionCountsRequest{}
|
|
}
|
|
path := fmt.Sprintf("/v1/observability/chat-completion-fields/%s/options-counts", url.PathEscape(fieldName))
|
|
var resp observability.FieldOptionCounts
|
|
if err := c.doJSON(ctx, "POST", path, req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|