/** * Exa API response types and result formatters for pi-exa. */ import type { AnswerResponse, CostDollars, DeepOutputSchema, DeepSearchOutput } from "exa-js"; export type OutputSchema = DeepOutputSchema | { type?: "object" | "text"; } | Record; export interface ExaResponseMetadata { costDollars?: CostDollars; searchTime?: number; } export interface ToolPerformResult { text: string; details: ExaResponseMetadata & Record; } export interface FormattedResearch { text: string; parsedOutput?: unknown; } export type { CompanyEntity, Entity, EntityCompanyProperties, EntityCompanyPropertiesFinancials, EntityCompanyPropertiesFundingRound, EntityCompanyPropertiesHeadquarters, EntityCompanyPropertiesWebTraffic, EntityCompanyPropertiesWorkforce, EntityDateRange, EntityPersonProperties, EntityPersonPropertiesCompanyRef, EntityPersonPropertiesWorkHistoryEntry, PersonEntity, }; type SearchResultSubpage = { url?: string; title?: string | null; publishedDate?: string; author?: string; text?: string; highlights?: string[]; summary?: string; }; type SearchResultForFormatting = { title?: string | null; url: string; publishedDate?: string; author?: string; text?: string; highlights?: string[]; summary?: string; subpages?: SearchResultSubpage[] | unknown[]; entities?: Entity[]; }; /** Company workforce information. */ type EntityCompanyPropertiesWorkforce = { total?: number | null; }; /** Company headquarters information. */ type EntityCompanyPropertiesHeadquarters = { address?: string | null; city?: string | null; postalCode?: string | null; country?: string | null; }; /** Funding round information. */ type EntityCompanyPropertiesFundingRound = { name?: string | null; date?: string | null; amount?: number | null; }; /** Company financial information. */ type EntityCompanyPropertiesFinancials = { revenueAnnual?: number | null; fundingTotal?: number | null; fundingLatestRound?: EntityCompanyPropertiesFundingRound | null; }; /** Company web traffic information. */ type EntityCompanyPropertiesWebTraffic = { visitsMonthly?: number | null; }; /** Structured properties for a company entity. */ type EntityCompanyProperties = { name?: string | null; foundedYear?: number | null; description?: string | null; industry?: string | null; workforce?: EntityCompanyPropertiesWorkforce | null; headquarters?: EntityCompanyPropertiesHeadquarters | null; financials?: EntityCompanyPropertiesFinancials | null; webTraffic?: EntityCompanyPropertiesWebTraffic | null; }; /** Date range for work history entries. */ type EntityDateRange = { from?: string | null; to?: string | null; }; /** Reference to a company in work history. */ type EntityPersonPropertiesCompanyRef = { id?: string | null; name?: string | null; location?: string | null; }; /** A single work history entry for a person. */ type EntityPersonPropertiesWorkHistoryEntry = { title?: string | null; location?: string | null; dates?: EntityDateRange | null; company?: EntityPersonPropertiesCompanyRef | null; }; /** Structured properties for a person entity. */ type EntityPersonProperties = { name?: string | null; location?: string | null; workHistory?: EntityPersonPropertiesWorkHistoryEntry[]; }; /** Structured entity data for a company. */ type CompanyEntity = { id: string; type: "company"; version: number; properties: EntityCompanyProperties; }; /** Structured entity data for a person. */ type PersonEntity = { id: string; type: "person"; version: number; properties: EntityPersonProperties; }; /** Structured entity data for company or person search results. */ type Entity = CompanyEntity | PersonEntity; export declare function formatSearchResults(results: SearchResultForFormatting[]): string; export declare function formatCrawlResults(results: SearchResultForFormatting[]): string; export declare function formatResearchOutput(output: DeepSearchOutput | undefined, outputSchema?: OutputSchema): FormattedResearch; export declare function formatAnswerResult(response: AnswerResponse, outputSchema?: OutputSchema): FormattedResearch; export declare function toMetadata(response: { costDollars?: CostDollars; searchTime?: number; }): ExaResponseMetadata;