aiconfigvariationpatch.ts•5.38 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
Message,
Message$inboundSchema,
Message$Outbound,
Message$outboundSchema,
} from "./message.js";
export type AIConfigVariationPatchModel = {};
export type AIConfigVariationPatch = {
/**
* Human-readable description of what this patch changes
*/
comment?: string | undefined;
/**
* Description for agent when AI Config is in agent mode.
*/
description?: string | undefined;
/**
* Instructions for agent when AI Config is in agent mode.
*/
instructions?: string | undefined;
messages?: Array<Message> | undefined;
model?: AIConfigVariationPatchModel | undefined;
modelConfigKey?: string | undefined;
name?: string | undefined;
published?: boolean | undefined;
/**
* One of 'archived', 'published'
*/
state?: string | undefined;
};
/** @internal */
export const AIConfigVariationPatchModel$inboundSchema: z.ZodType<
AIConfigVariationPatchModel,
z.ZodTypeDef,
unknown
> = z.object({});
/** @internal */
export type AIConfigVariationPatchModel$Outbound = {};
/** @internal */
export const AIConfigVariationPatchModel$outboundSchema: z.ZodType<
AIConfigVariationPatchModel$Outbound,
z.ZodTypeDef,
AIConfigVariationPatchModel
> = z.object({});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigVariationPatchModel$ {
/** @deprecated use `AIConfigVariationPatchModel$inboundSchema` instead. */
export const inboundSchema = AIConfigVariationPatchModel$inboundSchema;
/** @deprecated use `AIConfigVariationPatchModel$outboundSchema` instead. */
export const outboundSchema = AIConfigVariationPatchModel$outboundSchema;
/** @deprecated use `AIConfigVariationPatchModel$Outbound` instead. */
export type Outbound = AIConfigVariationPatchModel$Outbound;
}
export function aiConfigVariationPatchModelToJSON(
aiConfigVariationPatchModel: AIConfigVariationPatchModel,
): string {
return JSON.stringify(
AIConfigVariationPatchModel$outboundSchema.parse(
aiConfigVariationPatchModel,
),
);
}
export function aiConfigVariationPatchModelFromJSON(
jsonString: string,
): SafeParseResult<AIConfigVariationPatchModel, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigVariationPatchModel$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigVariationPatchModel' from JSON`,
);
}
/** @internal */
export const AIConfigVariationPatch$inboundSchema: z.ZodType<
AIConfigVariationPatch,
z.ZodTypeDef,
unknown
> = z.object({
comment: z.string().optional(),
description: z.string().optional(),
instructions: z.string().optional(),
messages: z.array(Message$inboundSchema).optional(),
model: z.lazy(() => AIConfigVariationPatchModel$inboundSchema).optional(),
modelConfigKey: z.string().optional(),
name: z.string().optional(),
published: z.boolean().optional(),
state: z.string().optional(),
});
/** @internal */
export type AIConfigVariationPatch$Outbound = {
comment?: string | undefined;
description?: string | undefined;
instructions?: string | undefined;
messages?: Array<Message$Outbound> | undefined;
model?: AIConfigVariationPatchModel$Outbound | undefined;
modelConfigKey?: string | undefined;
name?: string | undefined;
published?: boolean | undefined;
state?: string | undefined;
};
/** @internal */
export const AIConfigVariationPatch$outboundSchema: z.ZodType<
AIConfigVariationPatch$Outbound,
z.ZodTypeDef,
AIConfigVariationPatch
> = z.object({
comment: z.string().optional(),
description: z.string().optional(),
instructions: z.string().optional(),
messages: z.array(Message$outboundSchema).optional(),
model: z.lazy(() => AIConfigVariationPatchModel$outboundSchema).optional(),
modelConfigKey: z.string().optional(),
name: z.string().optional(),
published: z.boolean().optional(),
state: z.string().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigVariationPatch$ {
/** @deprecated use `AIConfigVariationPatch$inboundSchema` instead. */
export const inboundSchema = AIConfigVariationPatch$inboundSchema;
/** @deprecated use `AIConfigVariationPatch$outboundSchema` instead. */
export const outboundSchema = AIConfigVariationPatch$outboundSchema;
/** @deprecated use `AIConfigVariationPatch$Outbound` instead. */
export type Outbound = AIConfigVariationPatch$Outbound;
}
export function aiConfigVariationPatchToJSON(
aiConfigVariationPatch: AIConfigVariationPatch,
): string {
return JSON.stringify(
AIConfigVariationPatch$outboundSchema.parse(aiConfigVariationPatch),
);
}
export function aiConfigVariationPatchFromJSON(
jsonString: string,
): SafeParseResult<AIConfigVariationPatch, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigVariationPatch$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigVariationPatch' from JSON`,
);
}