export type CreateApiTakoV1KnowledgeSearchArgs = {body: {inputs: Record, source_indexes?: Array | undefined, country_code?: string | undefined, locale?: string | undefined, output_settings?: Record | undefined}}; export type CreateApiTakoV1KnowledgeSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for data visualizations using natural language. Ask any question about finance, economics, demographics, sports, politics, climate, or health and get back interactive knowledge cards with charts, data, and source attribution. Example: {"inputs": {"text": "NVIDIA vs AMD revenue since 2018"}}. Returns cards with title, chart image URL, interactive webpage URL, embeddable URL, data description, and source information. * * POST /tako/v1/knowledge_search */ export const createApiTakoV1KnowledgeSearch = async (args: CreateApiTakoV1KnowledgeSearchArgs, options?: CreateApiTakoV1KnowledgeSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tako/v1/knowledge_search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };