{"version":3,"file":"answer.cjs","names":["z","action"],"sources":["../../src/actions/answer.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const ExaAnswerInput: z.ZodTypeAny = z.object({\n  text: z.boolean().default(false).describe(\"Set to `true` to include the full text content of the cited source documents in the `citations` part of the response. Defaults to `false`.\").optional(),\n  model: z.enum([\"exa\", \"exa-pro\"]).default(\"exa\").describe(\"Specifies the search model to use. 'exa' uses a single, direct query. 'exa-pro' uses two expanded queries for potentially more comprehensive results. Allowed values are 'exa' or 'exa-pro'. Defaults to 'exa'.\").optional(),\n  query: z.string().describe(\"The natural language question or search query for which an answer is sought. The query should be specific enough to guide the search effectively. Include concrete entities, dates, locations, or jurisdictions to avoid ambiguous results. For time-sensitive data, include explicit time framing (e.g., 'as of 2024') since results may reflect stale information.\"),\n  stream: z.boolean().default(false).describe(\"Set to `true` to receive the response as a stream of server-sent events (SSE). This is useful for displaying results incrementally. Defaults to `false`.\").optional(),\n}).describe(\"Request model for generating an answer based on a query.\");\nconst ExaAnswer_AnswerSourceSchema: z.ZodTypeAny = z.object({\n  url: z.string().describe(\"URL of the source document.\").optional(),\n  title: z.string().describe(\"Title of the source, if available from Exa's /answer 'sources' field.\").optional(),\n  documentId: z.string().describe(\"ID of the source document if it was an uploaded document.\").optional(),\n}).describe(\"Represents a primary source used for generating the answer.\");\nconst ExaAnswer_CitationSchema: z.ZodTypeAny = z.object({\n  id: z.string().describe(\"A unique temporary identifier assigned to the cited document within this response.\").optional(),\n  url: z.string().describe(\"The direct URL of the original web page or document that serves as a source for the answer.\").optional(),\n  text: z.string().describe(\"The full text content of the cited document. This field is populated only if the `text` parameter in the `AnswerRequest` was set to `true`. Use sparingly — `text=true` produces large payloads with higher latency and cost.\").optional(),\n  image: z.string().describe(\"A URL for an image associated with the cited document, if available.\").optional(),\n  score: z.number().describe(\"Relevance score of the result\").optional(),\n  title: z.string().describe(\"The title of the web page or document cited.\").optional(),\n  author: z.string().describe(\"The author(s) of the cited content, if this information is available.\").optional(),\n  favicon: z.string().describe(\"A URL for the favicon of the website hosting the cited document, if available.\").optional(),\n  snippet: z.string().describe(\"A short snippet from the search result\").optional(),\n  publishedDate: z.string().describe(\"The publication date of the cited content, formatted as YYYY-MM-DD, if available.\").optional(),\n}).describe(\"Model for citation information in the response, detailing a source document.\");\nconst ExaAnswer_CitedChunkSchema: z.ZodTypeAny = z.object({\n  text: z.string().describe(\"The excerpt of text cited from a source.\").optional(),\n  documentId: z.string().describe(\"ID of the document from which the chunk is cited.\").optional(),\n  source_url: z.string().describe(\"URL of the document from which the chunk is cited.\").optional(),\n}).describe(\"Represents a specific chunk of text cited from a source document.\");\nconst ExaAnswer_CostBreakdownDetailSchema: z.ZodTypeAny = z.object({\n  contentText: z.number().describe(\"Cost of text content retrieval.\"),\n  neuralSearch: z.number().describe(\"Cost of neural search operations.\"),\n  keywordSearch: z.number().describe(\"Cost of keyword search operations.\"),\n  contentSummary: z.number().describe(\"Cost of summary generation.\"),\n  contentHighlight: z.number().describe(\"Cost of highlight generation.\"),\n}).describe(\"Detailed breakdown of costs for search and content operations.\");\nconst ExaAnswer_CostBreakdownItemSchema: z.ZodTypeAny = z.object({\n  search: z.number().describe(\"Cost of search operations.\"),\n  contents: z.number().describe(\"Cost of content operations.\"),\n  breakdown: ExaAnswer_CostBreakdownDetailSchema.nullable(),\n}).describe(\"Item in the cost breakdown, detailing search and content costs.\");\nconst ExaAnswer_PerPagePricesSchema: z.ZodTypeAny = z.object({\n  contentText: z.number().describe(\"Standard price per page for text content.\"),\n  contentSummary: z.number().describe(\"Standard price per page for summaries.\"),\n  contentHighlight: z.number().describe(\"Standard price per page for highlights.\"),\n}).describe(\"Standard price per page for different content operations.\");\nconst ExaAnswer_PerRequestPricesSchema: z.ZodTypeAny = z.object({\n  neuralSearch_1_25_results: z.number().describe(\"Standard price for neural search with 1-25 results.\"),\n  keywordSearch_1_100_results: z.number().describe(\"Standard price for keyword search with 1-100 results.\"),\n  neuralSearch_26_100_results: z.number().describe(\"Standard price for neural search with 26-100 results.\"),\n  neuralSearch_100_plus_results: z.number().describe(\"Standard price for neural search with 100+ results.\"),\n  keywordSearch_100_plus_results: z.number().describe(\"Standard price for keyword search with 100+ results.\"),\n}).describe(\"Standard price per request for different operations.\");\nconst ExaAnswer_CostDollarsSchema: z.ZodTypeAny = z.object({\n  total: z.number().describe(\"Total dollar cost for the request.\"),\n  breakDown: z.array(ExaAnswer_CostBreakdownItemSchema).describe(\"Breakdown of costs by operation type.\").optional(),\n  perPagePrices: ExaAnswer_PerPagePricesSchema.nullable().optional(),\n  perRequestPrices: ExaAnswer_PerRequestPricesSchema.nullable().optional(),\n}).describe(\"Model for cost information in the response.\");\nexport const ExaAnswerOutput: z.ZodTypeAny = z.object({\n  answer: z.string().describe(\"The synthesized, natural language answer to the input query, generated from the information found in the cited sources.\").optional(),\n  sources: z.array(ExaAnswer_AnswerSourceSchema).describe(\"List of primary source identifiers (URLs/IDs) used to formulate the answer.\").optional(),\n  answerId: z.string().describe(\"A unique identifier for this answer interaction, if provided by Exa.\").optional(),\n  citations: z.array(ExaAnswer_CitationSchema).describe(\"A list of `Citation` objects, each detailing a source document that contributed to the generated answer. Provides evidence and links to original content.\"),\n  citedChunks: z.array(ExaAnswer_CitedChunkSchema).describe(\"Specific text excerpts cited from sources supporting the answer.\").optional(),\n  costDollars: ExaAnswer_CostDollarsSchema.nullable().optional(),\n  followupQuestions: z.array(z.string()).describe(\"Suggested follow-up questions related to the query.\").optional(),\n}).describe(\"Response model containing the generated answer and its citations.\");\n\nexport const exaAnswer = action(\"EXA_ANSWER\", {\n  slug: \"exa-answer\",\n  name: \"Generate an answer\",\n  description: \"Generates a direct, citation-backed answer to a clear natural language question or topic using Exa's search, adept at both specific answers and detailed summaries for open-ended queries. Response contains an `answer` field (summary) and a `citations` field (supporting URLs). Citations may include low-credibility sources; verify authoritative references for factual use.\",\n  input: ExaAnswerInput,\n  output: ExaAnswerOutput,\n});\n"],"mappings":";;;AAIA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