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

Function marshalChatModelCallConfig

coderd/exp_chats.go:7403–7419  ·  view source on GitHub ↗
(
	modelConfig *codersdk.ChatModelCallConfig,
)

Source from the content-addressed store, hash-verified

7401}
7402
7403func marshalChatModelCallConfig(
7404 modelConfig *codersdk.ChatModelCallConfig,
7405) (json.RawMessage, error) {
7406 if modelConfig == nil {
7407 return json.RawMessage("{}"), nil
7408 }
7409
7410 if err := validateChatModelCallConfig(modelConfig); err != nil {
7411 return nil, err
7412 }
7413
7414 encoded, err := json.Marshal(modelConfig)
7415 if err != nil {
7416 return nil, xerrors.Errorf("encode model config: %w", err)
7417 }
7418 return encoded, nil
7419}
7420
7421func validateChatModelCallConfig(modelConfig *codersdk.ChatModelCallConfig) error {
7422 if modelConfig == nil {

Callers 2

createChatModelConfigMethod · 0.85
updateChatModelConfigMethod · 0.85

Calls 3

MarshalMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected