UNPKG

@aj-archipelago/cortex

Version:

Cortex is a GraphQL API for AI. It provides a simple, extensible interface for using AI services from OpenAI, Azure and others.

32 lines (26 loc) 861 B
import {type ChatMessage, type CortexVariables, getCortexResponse} from "./utils"; const STYLE_QUERY = ` query Style($text: String, $contextId: String, $chatHistory: [MultiMessage], $aiName: String, $aiStyle: String) { sys_generator_voice_sample(text: $text, contextId: $contextId, chatHistory: $chatHistory, aiName: $aiName, aiStyle: $aiStyle) { result tool errors warnings } } ` export async function style(contextId: string, aiName: string, aiStyle: string, chatHistory: ChatMessage[], text: string) { const variables: CortexVariables = { chatHistory, contextId, aiName, aiStyle, text } const res = await getCortexResponse(variables, STYLE_QUERY); return res.sys_generator_voice_sample; }