aiconfigvariation.ts•6.26 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
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";
import {
ParentLink,
ParentLink$inboundSchema,
ParentLink$Outbound,
ParentLink$outboundSchema,
} from "./parentlink.js";
export type AIConfigVariationModel = {};
export type AIConfigVariation = {
links?: ParentLink | undefined;
color?: string | undefined;
comment?: string | undefined;
/**
* Returns the description for the agent. This is only returned for agent variations.
*/
description?: string | undefined;
/**
* Returns the instructions for the agent. This is only returned for agent variations.
*/
instructions?: string | undefined;
key: string;
id: string;
messages?: Array<Message> | undefined;
model: AIConfigVariationModel;
modelConfigKey?: string | undefined;
name: string;
createdAt: number;
version: number;
state?: string | undefined;
archivedAt?: number | undefined;
publishedAt?: number | undefined;
};
/** @internal */
export const AIConfigVariationModel$inboundSchema: z.ZodType<
AIConfigVariationModel,
z.ZodTypeDef,
unknown
> = z.object({});
/** @internal */
export type AIConfigVariationModel$Outbound = {};
/** @internal */
export const AIConfigVariationModel$outboundSchema: z.ZodType<
AIConfigVariationModel$Outbound,
z.ZodTypeDef,
AIConfigVariationModel
> = 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 AIConfigVariationModel$ {
/** @deprecated use `AIConfigVariationModel$inboundSchema` instead. */
export const inboundSchema = AIConfigVariationModel$inboundSchema;
/** @deprecated use `AIConfigVariationModel$outboundSchema` instead. */
export const outboundSchema = AIConfigVariationModel$outboundSchema;
/** @deprecated use `AIConfigVariationModel$Outbound` instead. */
export type Outbound = AIConfigVariationModel$Outbound;
}
export function aiConfigVariationModelToJSON(
aiConfigVariationModel: AIConfigVariationModel,
): string {
return JSON.stringify(
AIConfigVariationModel$outboundSchema.parse(aiConfigVariationModel),
);
}
export function aiConfigVariationModelFromJSON(
jsonString: string,
): SafeParseResult<AIConfigVariationModel, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigVariationModel$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigVariationModel' from JSON`,
);
}
/** @internal */
export const AIConfigVariation$inboundSchema: z.ZodType<
AIConfigVariation,
z.ZodTypeDef,
unknown
> = z.object({
_links: ParentLink$inboundSchema.optional(),
color: z.string().optional(),
comment: z.string().optional(),
description: z.string().optional(),
instructions: z.string().optional(),
key: z.string(),
_id: z.string(),
messages: z.array(Message$inboundSchema).optional(),
model: z.lazy(() => AIConfigVariationModel$inboundSchema),
modelConfigKey: z.string().optional(),
name: z.string(),
createdAt: z.number().int(),
version: z.number().int(),
state: z.string().optional(),
_archivedAt: z.number().int().optional(),
_publishedAt: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
"_id": "id",
"_archivedAt": "archivedAt",
"_publishedAt": "publishedAt",
});
});
/** @internal */
export type AIConfigVariation$Outbound = {
_links?: ParentLink$Outbound | undefined;
color?: string | undefined;
comment?: string | undefined;
description?: string | undefined;
instructions?: string | undefined;
key: string;
_id: string;
messages?: Array<Message$Outbound> | undefined;
model: AIConfigVariationModel$Outbound;
modelConfigKey?: string | undefined;
name: string;
createdAt: number;
version: number;
state?: string | undefined;
_archivedAt?: number | undefined;
_publishedAt?: number | undefined;
};
/** @internal */
export const AIConfigVariation$outboundSchema: z.ZodType<
AIConfigVariation$Outbound,
z.ZodTypeDef,
AIConfigVariation
> = z.object({
links: ParentLink$outboundSchema.optional(),
color: z.string().optional(),
comment: z.string().optional(),
description: z.string().optional(),
instructions: z.string().optional(),
key: z.string(),
id: z.string(),
messages: z.array(Message$outboundSchema).optional(),
model: z.lazy(() => AIConfigVariationModel$outboundSchema),
modelConfigKey: z.string().optional(),
name: z.string(),
createdAt: z.number().int(),
version: z.number().int(),
state: z.string().optional(),
archivedAt: z.number().int().optional(),
publishedAt: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
links: "_links",
id: "_id",
archivedAt: "_archivedAt",
publishedAt: "_publishedAt",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigVariation$ {
/** @deprecated use `AIConfigVariation$inboundSchema` instead. */
export const inboundSchema = AIConfigVariation$inboundSchema;
/** @deprecated use `AIConfigVariation$outboundSchema` instead. */
export const outboundSchema = AIConfigVariation$outboundSchema;
/** @deprecated use `AIConfigVariation$Outbound` instead. */
export type Outbound = AIConfigVariation$Outbound;
}
export function aiConfigVariationToJSON(
aiConfigVariation: AIConfigVariation,
): string {
return JSON.stringify(
AIConfigVariation$outboundSchema.parse(aiConfigVariation),
);
}
export function aiConfigVariationFromJSON(
jsonString: string,
): SafeParseResult<AIConfigVariation, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigVariation$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigVariation' from JSON`,
);
}