pi-web-providers 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +32 -16
  2. package/dist/index.js +780 -162
  3. package/package.json +17 -17
package/dist/index.js CHANGED
@@ -1276,6 +1276,12 @@ function literalUnion(values, options) {
1276
1276
  options
1277
1277
  );
1278
1278
  }
1279
+ function boolOrConfig(options) {
1280
+ return Type2.Union(
1281
+ [Type2.Boolean(), Type2.Record(Type2.String(), Type2.Any())],
1282
+ options
1283
+ );
1284
+ }
1279
1285
 
1280
1286
  // src/providers/claude.ts
1281
1287
  var SEARCH_OUTPUT_SCHEMA = {
@@ -1358,6 +1364,11 @@ var claudeOptionsSchema = Type3.Object(
1358
1364
  },
1359
1365
  { description: "Claude options." }
1360
1366
  );
1367
+ var claudeSearchPromptGuidelines = [
1368
+ "Use Claude search when Claude Code's agentic web-browsing and synthesis are useful for finding likely sources.",
1369
+ "Increase effort or maxTurns only for difficult, ambiguous, or multi-step source discovery; keep defaults for simple searches.",
1370
+ "Prefer web_contents after Claude search when the task requires direct inspection of a small set of selected URLs."
1371
+ ];
1361
1372
  var claudeImplementation = {
1362
1373
  id: "claude",
1363
1374
  label: "Claude",
@@ -1615,6 +1626,7 @@ var claudeProvider = defineProvider({
1615
1626
  capabilities: {
1616
1627
  search: defineCapability({
1617
1628
  options: claudeImplementation.getToolOptionsSchema?.("search"),
1629
+ promptGuidelines: claudeSearchPromptGuidelines,
1618
1630
  async execute(input, ctx) {
1619
1631
  const { query: query2, maxResults, options } = input;
1620
1632
  return await claudeImplementation.search(
@@ -1833,6 +1845,11 @@ var codexSearchOptionsSchema = Type5.Object(
1833
1845
  },
1834
1846
  { description: "Codex search options." }
1835
1847
  );
1848
+ var codexSearchPromptGuidelines = [
1849
+ "Use Codex search when the local Codex SDK should perform web-backed source discovery, especially for coding or developer-oriented investigations.",
1850
+ "Use webSearchMode='live' for current information and 'cached' when freshness is less important; do not set 'disabled' for normal web_search calls.",
1851
+ "Increase modelReasoningEffort only for difficult or ambiguous searches where deeper reasoning is worth the extra latency."
1852
+ ];
1836
1853
  var codexImplementation = {
1837
1854
  id: "codex",
1838
1855
  label: "Codex",
@@ -2013,6 +2030,7 @@ var codexProvider = defineProvider({
2013
2030
  capabilities: {
2014
2031
  search: defineCapability({
2015
2032
  options: codexImplementation.getToolOptionsSchema?.("search"),
2033
+ promptGuidelines: codexSearchPromptGuidelines,
2016
2034
  async execute(input, ctx) {
2017
2035
  const { query: query2, maxResults, options } = input;
2018
2036
  return await codexImplementation.search(
@@ -2806,9 +2824,9 @@ var exaSearchOptionsSchema = Type6.Object(
2806
2824
  "hybrid",
2807
2825
  "fast",
2808
2826
  "instant",
2827
+ "deep-lite",
2809
2828
  "deep",
2810
- "deep-reasoning",
2811
- "deep-max"
2829
+ "deep-reasoning"
2812
2830
  ],
2813
2831
  { description: "Exa search mode." }
2814
2832
  )
@@ -2826,6 +2844,14 @@ var exaSearchOptionsSchema = Type6.Object(
2826
2844
  excludeDomains: Type6.Optional(
2827
2845
  Type6.Array(Type6.String(), { description: "Exclude these domains." })
2828
2846
  ),
2847
+ startCrawlDate: Type6.Optional(
2848
+ Type6.String({
2849
+ description: "ISO date string for earliest crawl date."
2850
+ })
2851
+ ),
2852
+ endCrawlDate: Type6.Optional(
2853
+ Type6.String({ description: "ISO date string for latest crawl date." })
2854
+ ),
2829
2855
  startPublishedDate: Type6.Optional(
2830
2856
  Type6.String({
2831
2857
  description: "ISO date string for earliest publish date."
@@ -2834,48 +2860,173 @@ var exaSearchOptionsSchema = Type6.Object(
2834
2860
  endPublishedDate: Type6.Optional(
2835
2861
  Type6.String({ description: "ISO date string for latest publish date." })
2836
2862
  ),
2863
+ includeText: Type6.Optional(
2864
+ Type6.Array(Type6.String(), {
2865
+ description: "Require result page text to contain these terms. Exa currently supports one short phrase."
2866
+ })
2867
+ ),
2868
+ excludeText: Type6.Optional(
2869
+ Type6.Array(Type6.String(), {
2870
+ description: "Require result page text not to contain these terms. Exa currently supports one short phrase."
2871
+ })
2872
+ ),
2873
+ systemPrompt: Type6.Optional(
2874
+ Type6.String({
2875
+ description: "Additional Exa instructions for deep search source selection and synthesis."
2876
+ })
2877
+ ),
2878
+ additionalQueries: Type6.Optional(
2879
+ Type6.Array(Type6.String(), {
2880
+ maxItems: 5,
2881
+ description: "Alternative query formulations for Exa deep search variants."
2882
+ })
2883
+ ),
2837
2884
  userLocation: Type6.Optional(
2838
- Type6.Object(
2839
- {
2840
- country: Type6.Optional(
2841
- Type6.String({ description: "Country hint for the user location." })
2842
- ),
2843
- region: Type6.Optional(
2844
- Type6.String({ description: "Region hint for the user location." })
2845
- ),
2846
- city: Type6.Optional(
2847
- Type6.String({ description: "City hint for the user location." })
2848
- ),
2849
- timezone: Type6.Optional(
2850
- Type6.String({
2851
- description: "Timezone hint for the user location."
2852
- })
2853
- )
2854
- },
2855
- {
2856
- description: "User location hint passed through to the Exa SDK."
2857
- }
2858
- )
2885
+ Type6.String({
2886
+ description: "Two-letter ISO country code for the user location, such as 'US'."
2887
+ })
2859
2888
  ),
2860
2889
  contents: Type6.Optional(
2861
2890
  Type6.Object(
2862
2891
  {
2863
2892
  text: Type6.Optional(
2864
- Type6.Boolean({ description: "Include text content." })
2893
+ Type6.Union(
2894
+ [
2895
+ Type6.Boolean(),
2896
+ Type6.Object(
2897
+ {
2898
+ maxCharacters: Type6.Optional(
2899
+ Type6.Integer({
2900
+ minimum: 1,
2901
+ description: "Maximum text characters per result."
2902
+ })
2903
+ ),
2904
+ includeHtmlTags: Type6.Optional(
2905
+ Type6.Boolean({
2906
+ description: "Include HTML tags in returned text."
2907
+ })
2908
+ ),
2909
+ verbosity: Type6.Optional(
2910
+ literalUnion(["compact", "standard", "full"], {
2911
+ description: "Verbosity level for returned text."
2912
+ })
2913
+ )
2914
+ },
2915
+ { additionalProperties: false }
2916
+ )
2917
+ ],
2918
+ { description: "Include text content." }
2919
+ )
2865
2920
  ),
2866
2921
  highlights: Type6.Optional(
2867
- Type6.Boolean({ description: "Include highlighted excerpts." })
2922
+ Type6.Union(
2923
+ [
2924
+ Type6.Boolean(),
2925
+ Type6.Object(
2926
+ {
2927
+ query: Type6.Optional(
2928
+ Type6.String({
2929
+ description: "Query to use for highlights."
2930
+ })
2931
+ ),
2932
+ maxCharacters: Type6.Optional(
2933
+ Type6.Integer({
2934
+ minimum: 1,
2935
+ description: "Maximum highlight characters."
2936
+ })
2937
+ )
2938
+ },
2939
+ { additionalProperties: false }
2940
+ )
2941
+ ],
2942
+ { description: "Include highlighted excerpts." }
2943
+ )
2868
2944
  ),
2869
2945
  summary: Type6.Optional(
2870
- Type6.Boolean({ description: "Include AI-generated summary." })
2946
+ Type6.Union(
2947
+ [
2948
+ Type6.Boolean(),
2949
+ Type6.Object(
2950
+ {
2951
+ query: Type6.Optional(
2952
+ Type6.String({
2953
+ description: "Query to guide summary generation."
2954
+ })
2955
+ )
2956
+ },
2957
+ { additionalProperties: false }
2958
+ )
2959
+ ],
2960
+ { description: "Include AI-generated summary." }
2961
+ )
2962
+ ),
2963
+ livecrawl: Type6.Optional(
2964
+ literalUnion(["never", "fallback", "always", "auto", "preferred"], {
2965
+ description: "Livecrawl mode for fetching fresh content."
2966
+ })
2967
+ ),
2968
+ livecrawlTimeout: Type6.Optional(
2969
+ Type6.Integer({
2970
+ minimum: 0,
2971
+ description: "Livecrawl timeout in milliseconds."
2972
+ })
2973
+ ),
2974
+ maxAgeHours: Type6.Optional(
2975
+ Type6.Number({
2976
+ description: "Maximum age of cached content in hours. Use 0 to always fetch fresh content."
2977
+ })
2978
+ ),
2979
+ filterEmptyResults: Type6.Optional(
2980
+ Type6.Boolean({ description: "Filter results with no contents." })
2981
+ ),
2982
+ subpages: Type6.Optional(
2983
+ Type6.Integer({
2984
+ minimum: 0,
2985
+ description: "Number of subpages to return for each result."
2986
+ })
2987
+ ),
2988
+ subpageTarget: Type6.Optional(
2989
+ Type6.Union([Type6.String(), Type6.Array(Type6.String())], {
2990
+ description: "Text used to match/rank returned subpages."
2991
+ })
2992
+ ),
2993
+ extras: Type6.Optional(
2994
+ Type6.Object(
2995
+ {
2996
+ links: Type6.Optional(
2997
+ Type6.Integer({
2998
+ minimum: 0,
2999
+ description: "Number of page links to include."
3000
+ })
3001
+ ),
3002
+ imageLinks: Type6.Optional(
3003
+ Type6.Integer({
3004
+ minimum: 0,
3005
+ description: "Number of image links to include."
3006
+ })
3007
+ )
3008
+ },
3009
+ { additionalProperties: false }
3010
+ )
2871
3011
  )
2872
3012
  },
2873
- { description: "What content to include in results." }
3013
+ {
3014
+ additionalProperties: false,
3015
+ description: "What content to include in results."
3016
+ }
2874
3017
  )
2875
3018
  )
2876
3019
  },
2877
3020
  { description: "Exa search options." }
2878
3021
  );
3022
+ var exaSearchPromptGuidelines = [
3023
+ "Use Exa's neural/auto search modes for semantic source discovery where exact keywords are uncertain; use keyword mode when exact terms, names, or identifiers matter.",
3024
+ "Use Exa category filters such as 'research paper' or 'company' when the user asks for a specific source type.",
3025
+ "Set includeDomains or excludeDomains when the task names preferred sources, requires primary sources, or needs noisy domains filtered out.",
3026
+ "Use startCrawlDate/endCrawlDate or contents.maxAgeHours when freshness of Exa's crawled content matters.",
3027
+ "Use includeText/excludeText for short required or forbidden phrases in page text.",
3028
+ "Request contents.text, contents.highlights, or contents.summary only when snippets are insufficient and richer source context is needed directly in search results."
3029
+ ];
2879
3030
  var exaImplementation = {
2880
3031
  id: "exa",
2881
3032
  label: "Exa",
@@ -3046,6 +3197,7 @@ var exaProvider = defineProvider({
3046
3197
  capabilities: {
3047
3198
  search: defineCapability({
3048
3199
  options: exaImplementation.getToolOptionsSchema?.("search"),
3200
+ promptGuidelines: exaSearchPromptGuidelines,
3049
3201
  async execute(input, ctx) {
3050
3202
  const { query: query2, maxResults, options } = input;
3051
3203
  return await exaImplementation.search(
@@ -3121,6 +3273,26 @@ var firecrawlSearchOptionsSchema = Type7.Object(
3121
3273
  description: "Search categories to include."
3122
3274
  })
3123
3275
  ),
3276
+ includeDomains: Type7.Optional(
3277
+ Type7.Array(Type7.String(), {
3278
+ description: "Restrict results to these domains."
3279
+ })
3280
+ ),
3281
+ excludeDomains: Type7.Optional(
3282
+ Type7.Array(Type7.String(), {
3283
+ description: "Exclude these domains."
3284
+ })
3285
+ ),
3286
+ tbs: Type7.Optional(
3287
+ Type7.String({
3288
+ description: "Google-style time-based search filter."
3289
+ })
3290
+ ),
3291
+ ignoreInvalidURLs: Type7.Optional(
3292
+ Type7.Boolean({
3293
+ description: "Ignore invalid result URLs returned by search."
3294
+ })
3295
+ ),
3124
3296
  location: Type7.Optional(
3125
3297
  Type7.Object(
3126
3298
  {
@@ -3141,9 +3313,22 @@ var firecrawlSearchOptionsSchema = Type7.Object(
3141
3313
  Type7.Object(
3142
3314
  {
3143
3315
  formats: Type7.Optional(
3144
- Type7.Array(literalUnion(["markdown", "html", "rawHtml"]), {
3145
- description: "Output formats."
3146
- })
3316
+ Type7.Array(
3317
+ literalUnion([
3318
+ "markdown",
3319
+ "html",
3320
+ "rawHtml",
3321
+ "links",
3322
+ "images",
3323
+ "screenshot",
3324
+ "summary",
3325
+ "json",
3326
+ "attributes"
3327
+ ]),
3328
+ {
3329
+ description: "Output formats."
3330
+ }
3331
+ )
3147
3332
  ),
3148
3333
  onlyMainContent: Type7.Optional(
3149
3334
  Type7.Boolean({ description: "Extract only the main content." })
@@ -3157,51 +3342,133 @@ var firecrawlSearchOptionsSchema = Type7.Object(
3157
3342
  },
3158
3343
  { description: "Firecrawl search options." }
3159
3344
  );
3345
+ var firecrawlSearchPromptGuidelines = [
3346
+ "Use Firecrawl search when the task benefits from searchable results that can also include scraped page content through scrapeOptions.",
3347
+ "Set scrapeOptions.formats=['markdown'] and onlyMainContent=true when source snippets are not enough and the user needs extracted page context in the search results.",
3348
+ "Use includeDomains/excludeDomains when search should stay within or avoid specific sites.",
3349
+ "Use lang, country, or location when the user asks for language-specific, country-specific, or local results.",
3350
+ "Prefer web_contents with Firecrawl scrape options after search when only a small set of known URLs needs full extraction."
3351
+ ];
3352
+ var firecrawlScrapeTuningProperties = {
3353
+ onlyMainContent: Type7.Optional(
3354
+ Type7.Boolean({ description: "Extract only the main content." })
3355
+ ),
3356
+ includeTags: Type7.Optional(
3357
+ Type7.Array(Type7.String(), { description: "CSS selectors to include." })
3358
+ ),
3359
+ excludeTags: Type7.Optional(
3360
+ Type7.Array(Type7.String(), { description: "CSS selectors to exclude." })
3361
+ ),
3362
+ waitFor: Type7.Optional(
3363
+ Type7.Integer({
3364
+ minimum: 0,
3365
+ description: "Milliseconds to wait before scraping."
3366
+ })
3367
+ ),
3368
+ headers: Type7.Optional(
3369
+ Type7.Record(Type7.String(), Type7.String(), {
3370
+ description: "Headers to send when scraping."
3371
+ })
3372
+ ),
3373
+ location: Type7.Optional(
3374
+ Type7.Object(
3375
+ {
3376
+ country: Type7.Optional(Type7.String({ description: "Country hint." })),
3377
+ region: Type7.Optional(Type7.String({ description: "Region hint." })),
3378
+ city: Type7.Optional(Type7.String({ description: "City hint." }))
3379
+ },
3380
+ { description: "Location hint for scraping." }
3381
+ )
3382
+ ),
3383
+ mobile: Type7.Optional(
3384
+ Type7.Boolean({ description: "Use a mobile browser profile." })
3385
+ ),
3386
+ proxy: Type7.Optional(
3387
+ Type7.String({
3388
+ description: "Proxy mode passed through to the Firecrawl SDK."
3389
+ })
3390
+ ),
3391
+ fastMode: Type7.Optional(
3392
+ Type7.Boolean({ description: "Use Firecrawl fast mode." })
3393
+ ),
3394
+ blockAds: Type7.Optional(
3395
+ Type7.Boolean({ description: "Block ads while scraping." })
3396
+ ),
3397
+ removeBase64Images: Type7.Optional(
3398
+ Type7.Boolean({
3399
+ description: "Remove base64 image data from scraped output."
3400
+ })
3401
+ ),
3402
+ redactPII: Type7.Optional(
3403
+ Type7.Union(
3404
+ [
3405
+ Type7.Boolean(),
3406
+ Type7.Object(
3407
+ {
3408
+ entities: Type7.Optional(
3409
+ Type7.Array(
3410
+ literalUnion([
3411
+ "PERSON",
3412
+ "EMAIL",
3413
+ "PHONE",
3414
+ "LOCATION",
3415
+ "FINANCIAL",
3416
+ "SECRET"
3417
+ ])
3418
+ )
3419
+ )
3420
+ },
3421
+ { additionalProperties: false }
3422
+ )
3423
+ ],
3424
+ { description: "Redact personal or sensitive data from output." }
3425
+ )
3426
+ ),
3427
+ maxAge: Type7.Optional(
3428
+ Type7.Number({
3429
+ description: "Maximum age of cached scrape data in milliseconds."
3430
+ })
3431
+ ),
3432
+ minAge: Type7.Optional(
3433
+ Type7.Number({
3434
+ description: "Minimum age of cached scrape data in milliseconds."
3435
+ })
3436
+ ),
3437
+ storeInCache: Type7.Optional(
3438
+ Type7.Boolean({ description: "Store scrape result in Firecrawl cache." })
3439
+ ),
3440
+ skipTlsVerification: Type7.Optional(
3441
+ Type7.Boolean({ description: "Skip TLS certificate verification." })
3442
+ )
3443
+ };
3160
3444
  var firecrawlScrapeOptionsSchema = Type7.Object(
3161
3445
  {
3162
3446
  formats: Type7.Optional(
3163
- Type7.Array(literalUnion(["markdown", "html", "rawHtml"]), {
3164
- description: "Output formats for scraping."
3165
- })
3166
- ),
3167
- onlyMainContent: Type7.Optional(
3168
- Type7.Boolean({ description: "Extract only the main content." })
3169
- ),
3170
- includeTags: Type7.Optional(
3171
- Type7.Array(Type7.String(), { description: "CSS selectors to include." })
3172
- ),
3173
- excludeTags: Type7.Optional(
3174
- Type7.Array(Type7.String(), { description: "CSS selectors to exclude." })
3447
+ Type7.Array(
3448
+ literalUnion([
3449
+ "markdown",
3450
+ "html",
3451
+ "rawHtml",
3452
+ "links",
3453
+ "images",
3454
+ "screenshot",
3455
+ "summary",
3456
+ "json",
3457
+ "attributes",
3458
+ "changeTracking"
3459
+ ]),
3460
+ {
3461
+ description: "Output formats for scraping."
3462
+ }
3463
+ )
3175
3464
  ),
3176
- waitFor: Type7.Optional(
3465
+ timeout: Type7.Optional(
3177
3466
  Type7.Integer({
3178
3467
  minimum: 0,
3179
- description: "Milliseconds to wait before scraping."
3180
- })
3181
- ),
3182
- headers: Type7.Optional(
3183
- Type7.Record(Type7.String(), Type7.String(), {
3184
- description: "Headers to send when scraping."
3468
+ description: "Request timeout in milliseconds."
3185
3469
  })
3186
3470
  ),
3187
- location: Type7.Optional(
3188
- Type7.Object(
3189
- {
3190
- country: Type7.Optional(Type7.String({ description: "Country hint." })),
3191
- region: Type7.Optional(Type7.String({ description: "Region hint." })),
3192
- city: Type7.Optional(Type7.String({ description: "City hint." }))
3193
- },
3194
- { description: "Location hint for scraping." }
3195
- )
3196
- ),
3197
- mobile: Type7.Optional(
3198
- Type7.Boolean({ description: "Use a mobile browser profile." })
3199
- ),
3200
- proxy: Type7.Optional(
3201
- Type7.String({
3202
- description: "Proxy mode passed through to the Firecrawl SDK."
3203
- })
3204
- )
3471
+ ...firecrawlScrapeTuningProperties
3205
3472
  },
3206
3473
  { description: "Firecrawl scrape options." }
3207
3474
  );
@@ -3211,44 +3478,7 @@ var firecrawlAnswerOptionsSchema = Type7.Object(
3211
3478
  minLength: 1,
3212
3479
  description: "URL of the page to ask about."
3213
3480
  }),
3214
- onlyMainContent: Type7.Optional(
3215
- Type7.Boolean({ description: "Extract only the main content." })
3216
- ),
3217
- includeTags: Type7.Optional(
3218
- Type7.Array(Type7.String(), { description: "CSS selectors to include." })
3219
- ),
3220
- excludeTags: Type7.Optional(
3221
- Type7.Array(Type7.String(), { description: "CSS selectors to exclude." })
3222
- ),
3223
- waitFor: Type7.Optional(
3224
- Type7.Integer({
3225
- minimum: 0,
3226
- description: "Milliseconds to wait before scraping."
3227
- })
3228
- ),
3229
- headers: Type7.Optional(
3230
- Type7.Record(Type7.String(), Type7.String(), {
3231
- description: "Headers to send when scraping."
3232
- })
3233
- ),
3234
- location: Type7.Optional(
3235
- Type7.Object(
3236
- {
3237
- country: Type7.Optional(Type7.String({ description: "Country hint." })),
3238
- region: Type7.Optional(Type7.String({ description: "Region hint." })),
3239
- city: Type7.Optional(Type7.String({ description: "City hint." }))
3240
- },
3241
- { description: "Location hint for scraping." }
3242
- )
3243
- ),
3244
- mobile: Type7.Optional(
3245
- Type7.Boolean({ description: "Use a mobile browser profile." })
3246
- ),
3247
- proxy: Type7.Optional(
3248
- Type7.String({
3249
- description: "Proxy mode passed through to Firecrawl."
3250
- })
3251
- )
3481
+ ...firecrawlScrapeTuningProperties
3252
3482
  },
3253
3483
  {
3254
3484
  description: "Firecrawl page-question options. The URL is required; the question comes from the web_answer query."
@@ -3531,6 +3761,7 @@ var firecrawlProvider = defineProvider({
3531
3761
  capabilities: {
3532
3762
  search: defineCapability({
3533
3763
  options: firecrawlImplementation.getToolOptionsSchema?.("search"),
3764
+ promptGuidelines: firecrawlSearchPromptGuidelines,
3534
3765
  async execute(input, ctx) {
3535
3766
  const { query: query2, maxResults, options } = input;
3536
3767
  return await firecrawlImplementation.search(
@@ -3653,6 +3884,12 @@ var geminiSearchOptionsSchema = Type8.Object(
3653
3884
  },
3654
3885
  { description: "Gemini search options." }
3655
3886
  );
3887
+ var geminiSearchPromptGuidelines = [
3888
+ "Use Gemini search when a grounded model should perform web-backed source discovery and return likely sources.",
3889
+ "Change model only when the user requests a specific Gemini model or when project configuration requires it.",
3890
+ "Tune generation_config only for explicit output-control needs; avoid disabling tool use for search tasks.",
3891
+ "Prefer web_contents after Gemini search when selected sources need direct extraction or closer reading."
3892
+ ];
3656
3893
  var geminiAnswerOptionsSchema = Type8.Object(
3657
3894
  {
3658
3895
  model: Type8.Optional(
@@ -4341,6 +4578,7 @@ var geminiProvider = defineProvider({
4341
4578
  capabilities: {
4342
4579
  search: defineCapability({
4343
4580
  options: geminiImplementation.getToolOptionsSchema?.("search"),
4581
+ promptGuidelines: geminiSearchPromptGuidelines,
4344
4582
  async execute(input, ctx) {
4345
4583
  const { query: query2, maxResults, options } = input;
4346
4584
  return await geminiImplementation.search(
@@ -4409,6 +4647,12 @@ var linkupSearchOptionsSchema = Type9.Object(
4409
4647
  },
4410
4648
  { description: "Linkup search options." }
4411
4649
  );
4650
+ var linkupSearchPromptGuidelines = [
4651
+ "Use Linkup depth='deep' for exploratory or high-recall source discovery, and 'standard' for quick direct searches.",
4652
+ "Use includeDomains or excludeDomains when the user names source constraints or when limiting the search space improves precision.",
4653
+ "Use fromDate and toDate when the user asks for recent, historical, or bounded-by-date results.",
4654
+ "Enable includeImages only when images are directly useful; otherwise keep search focused on textual source discovery."
4655
+ ];
4412
4656
  var linkupContentsOptionsSchema = Type9.Object(
4413
4657
  {
4414
4658
  renderJs: Type9.Optional(
@@ -4778,6 +5022,7 @@ var linkupProvider = defineProvider({
4778
5022
  capabilities: {
4779
5023
  search: defineCapability({
4780
5024
  options: linkupImplementation.getToolOptionsSchema?.("search"),
5025
+ promptGuidelines: linkupSearchPromptGuidelines,
4781
5026
  async execute(input, ctx) {
4782
5027
  const { query: query2, maxResults, options } = input;
4783
5028
  return await linkupImplementation.search(
@@ -4987,11 +5232,40 @@ function buildFetchMetadata(data) {
4987
5232
  }
4988
5233
 
4989
5234
  // src/providers/openai.ts
4990
- import { Type as Type10 } from "typebox";
4991
5235
  import OpenAI from "openai";
5236
+ import { Type as Type10 } from "typebox";
4992
5237
  var DEFAULT_SEARCH_MODEL2 = "gpt-4.1";
4993
5238
  var DEFAULT_ANSWER_MODEL2 = "gpt-4.1";
4994
5239
  var DEFAULT_RESEARCH_MODEL = "o4-mini-deep-research";
5240
+ var openaiWebSearchToolProperties = {
5241
+ searchContextSize: Type10.Optional(
5242
+ literalUnion(["low", "medium", "high"], {
5243
+ description: "Amount of context OpenAI web search should retrieve per search."
5244
+ })
5245
+ ),
5246
+ allowedDomains: Type10.Optional(
5247
+ Type10.Array(Type10.String(), {
5248
+ description: "Restrict OpenAI web search to these domains."
5249
+ })
5250
+ ),
5251
+ userLocation: Type10.Optional(
5252
+ Type10.Object(
5253
+ {
5254
+ city: Type10.Optional(Type10.String({ description: "User city hint." })),
5255
+ country: Type10.Optional(
5256
+ Type10.String({ description: "Two-letter user country code." })
5257
+ ),
5258
+ region: Type10.Optional(
5259
+ Type10.String({ description: "User region hint." })
5260
+ ),
5261
+ timezone: Type10.Optional(
5262
+ Type10.String({ description: "IANA timezone hint." })
5263
+ )
5264
+ },
5265
+ { description: "Approximate user location for OpenAI web search." }
5266
+ )
5267
+ )
5268
+ };
4995
5269
  var openaiSearchOptionsSchema = Type10.Object(
4996
5270
  {
4997
5271
  model: Type10.Optional(
@@ -5003,10 +5277,19 @@ var openaiSearchOptionsSchema = Type10.Object(
5003
5277
  Type10.String({
5004
5278
  description: "Optional instructions that shape source selection and result style."
5005
5279
  })
5006
- )
5280
+ ),
5281
+ ...openaiWebSearchToolProperties
5007
5282
  },
5008
5283
  { description: "OpenAI search options." }
5009
5284
  );
5285
+ var openaiSearchPromptGuidelines = [
5286
+ "Use OpenAI web search when an LLM-mediated search pass should identify likely sources from the live web.",
5287
+ "Use instructions to constrain source selection, freshness, geography, or output style only when the user explicitly needs that control.",
5288
+ "Use allowedDomains when the user asks to search only specific sites or primary-source domains.",
5289
+ "Use searchContextSize='high' only when the query needs richer source context; use 'low' for quick source discovery.",
5290
+ "Use userLocation for local, regional, or jurisdiction-specific searches.",
5291
+ "Prefer web_contents after OpenAI search when the task requires direct inspection of selected primary sources."
5292
+ ];
5010
5293
  var openaiAnswerOptionsSchema = Type10.Object(
5011
5294
  {
5012
5295
  model: Type10.Optional(
@@ -5018,7 +5301,8 @@ var openaiAnswerOptionsSchema = Type10.Object(
5018
5301
  Type10.String({
5019
5302
  description: "Optional instructions that shape the answer structure, tone, and source selection."
5020
5303
  })
5021
- )
5304
+ ),
5305
+ ...openaiWebSearchToolProperties
5022
5306
  },
5023
5307
  { description: "OpenAI answer options." }
5024
5308
  );
@@ -5039,7 +5323,8 @@ var openaiResearchOptionsSchema = Type10.Object(
5039
5323
  minimum: 1,
5040
5324
  description: "Maximum number of built-in tool calls the model may make during the research run."
5041
5325
  })
5042
- )
5326
+ ),
5327
+ ...openaiWebSearchToolProperties
5043
5328
  },
5044
5329
  { description: "OpenAI deep research options." }
5045
5330
  );
@@ -5200,7 +5485,7 @@ function buildOpenAISearchRequest(query2, maxResults, config, options) {
5200
5485
  "",
5201
5486
  `User query: ${query2}`
5202
5487
  ].join("\n"),
5203
- tools: [{ type: "web_search_preview" }],
5488
+ tools: [buildOpenAIWebSearchTool(mergedOptions)],
5204
5489
  text: {
5205
5490
  format: {
5206
5491
  type: "json_schema",
@@ -5219,7 +5504,7 @@ function buildOpenAIAnswerRequest(query2, config, options) {
5219
5504
  return {
5220
5505
  model,
5221
5506
  input: query2,
5222
- tools: [{ type: "web_search_preview" }],
5507
+ tools: [buildOpenAIWebSearchTool(mergedOptions)],
5223
5508
  ...instructions ? { instructions } : {}
5224
5509
  };
5225
5510
  }
@@ -5232,11 +5517,41 @@ function buildOpenAIResearchRequest(input, config, options) {
5232
5517
  model,
5233
5518
  input,
5234
5519
  background: true,
5235
- tools: [{ type: "web_search_preview" }],
5520
+ tools: [buildOpenAIWebSearchTool(mergedOptions)],
5236
5521
  ...instructions ? { instructions } : {},
5237
5522
  ...maxToolCalls ? { max_tool_calls: maxToolCalls } : {}
5238
5523
  };
5239
5524
  }
5525
+ function buildOpenAIWebSearchTool(options) {
5526
+ const tool = { type: "web_search" };
5527
+ if (options.searchContextSize) {
5528
+ tool.search_context_size = options.searchContextSize;
5529
+ }
5530
+ if (options.allowedDomains && options.allowedDomains.length > 0) {
5531
+ tool.filters = { allowed_domains: options.allowedDomains };
5532
+ }
5533
+ if (options.userLocation) {
5534
+ tool.user_location = {
5535
+ type: "approximate",
5536
+ ...options.userLocation
5537
+ };
5538
+ }
5539
+ return tool;
5540
+ }
5541
+ function resolveOpenAIWebSearchToolOptions(merged) {
5542
+ const searchContextSize = readStringUnion(merged.searchContextSize, [
5543
+ "low",
5544
+ "medium",
5545
+ "high"
5546
+ ]);
5547
+ const allowedDomains = readStringArray(merged.allowedDomains);
5548
+ const userLocation = readUserLocation(merged.userLocation);
5549
+ return {
5550
+ ...searchContextSize ? { searchContextSize } : {},
5551
+ ...allowedDomains ? { allowedDomains } : {},
5552
+ ...userLocation ? { userLocation } : {}
5553
+ };
5554
+ }
5240
5555
  function resolveOpenAISearchOptions(config, options) {
5241
5556
  const mergedOptions = {
5242
5557
  ...config.options?.search ?? {},
@@ -5246,7 +5561,8 @@ function resolveOpenAISearchOptions(config, options) {
5246
5561
  const instructions = readNonEmptyString4(mergedOptions.instructions);
5247
5562
  return {
5248
5563
  ...model ? { model } : {},
5249
- ...instructions ? { instructions } : {}
5564
+ ...instructions ? { instructions } : {},
5565
+ ...resolveOpenAIWebSearchToolOptions(mergedOptions)
5250
5566
  };
5251
5567
  }
5252
5568
  function resolveOpenAIAnswerOptions(config, options) {
@@ -5258,7 +5574,8 @@ function resolveOpenAIAnswerOptions(config, options) {
5258
5574
  const instructions = readNonEmptyString4(mergedOptions.instructions);
5259
5575
  return {
5260
5576
  ...model ? { model } : {},
5261
- ...instructions ? { instructions } : {}
5577
+ ...instructions ? { instructions } : {},
5578
+ ...resolveOpenAIWebSearchToolOptions(mergedOptions)
5262
5579
  };
5263
5580
  }
5264
5581
  function resolveOpenAIResearchOptions(config, options) {
@@ -5272,7 +5589,8 @@ function resolveOpenAIResearchOptions(config, options) {
5272
5589
  return {
5273
5590
  ...model ? { model } : {},
5274
5591
  ...instructions ? { instructions } : {},
5275
- ...maxToolCalls ? { max_tool_calls: maxToolCalls } : {}
5592
+ ...maxToolCalls ? { max_tool_calls: maxToolCalls } : {},
5593
+ ...resolveOpenAIWebSearchToolOptions(mergedOptions)
5276
5594
  };
5277
5595
  }
5278
5596
  function buildRequestOptions2(signal, idempotencyKey) {
@@ -5437,6 +5755,35 @@ function formatIncompleteError(response, operation) {
5437
5755
  function readNonEmptyString4(value) {
5438
5756
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
5439
5757
  }
5758
+ function readStringArray(value) {
5759
+ if (!Array.isArray(value)) {
5760
+ return void 0;
5761
+ }
5762
+ const strings = value.filter(
5763
+ (item) => typeof item === "string" && item.trim() !== ""
5764
+ );
5765
+ return strings.length > 0 ? strings : void 0;
5766
+ }
5767
+ function readStringUnion(value, values) {
5768
+ return typeof value === "string" && values.includes(value) ? value : void 0;
5769
+ }
5770
+ function readUserLocation(value) {
5771
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
5772
+ return void 0;
5773
+ }
5774
+ const location = value;
5775
+ const city = readNonEmptyString4(location.city);
5776
+ const country = readNonEmptyString4(location.country);
5777
+ const region = readNonEmptyString4(location.region);
5778
+ const timezone = readNonEmptyString4(location.timezone);
5779
+ const result = {
5780
+ ...city ? { city } : {},
5781
+ ...country ? { country } : {},
5782
+ ...region ? { region } : {},
5783
+ ...timezone ? { timezone } : {}
5784
+ };
5785
+ return Object.keys(result).length > 0 ? result : void 0;
5786
+ }
5440
5787
  function readPositiveInteger2(value) {
5441
5788
  return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
5442
5789
  }
@@ -5461,6 +5808,7 @@ var openaiProvider = defineProvider({
5461
5808
  capabilities: {
5462
5809
  search: defineCapability({
5463
5810
  options: openaiImplementation.getToolOptionsSchema?.("search"),
5811
+ promptGuidelines: openaiSearchPromptGuidelines,
5464
5812
  async execute(input, ctx) {
5465
5813
  const { query: query2, maxResults, options } = input;
5466
5814
  return await openaiImplementation.search(
@@ -5503,13 +5851,19 @@ import { Type as Type11 } from "typebox";
5503
5851
  var parallelSearchOptionsSchema = Type11.Object(
5504
5852
  {
5505
5853
  mode: Type11.Optional(
5506
- literalUnion(["agentic", "one-shot"], {
5507
- description: "Parallel search mode. Use 'agentic' for exploratory or multi-step source discovery and 'one-shot' for direct, simple searches."
5854
+ literalUnion(["advanced", "basic", "turbo"], {
5855
+ description: "Parallel search mode. Use 'advanced' for higher quality, 'basic' for lower latency, or 'turbo' for the fastest responses."
5508
5856
  })
5509
5857
  )
5510
5858
  },
5511
5859
  { description: "Parallel search options." }
5512
5860
  );
5861
+ var parallelSearchPromptGuidelines = [
5862
+ "Use Parallel mode='advanced' for exploratory, ambiguous, or multi-hop source discovery where the provider should plan the search.",
5863
+ "Use Parallel mode='basic' for direct factual lookups and simple source finding where low latency is preferred.",
5864
+ "Use Parallel mode='turbo' only when fastest responses matter more than recall or depth.",
5865
+ "Prefer web_contents with Parallel extraction when a URL set is already known and the task needs full page content rather than more source discovery."
5866
+ ];
5513
5867
  var parallelExtractOptionsSchema = Type11.Object(
5514
5868
  {
5515
5869
  excerpts: Type11.Optional(
@@ -5542,7 +5896,7 @@ var parallelImplementation = {
5542
5896
  credentials: { api: "PARALLEL_API_KEY" },
5543
5897
  options: {
5544
5898
  search: {
5545
- mode: "agentic"
5899
+ mode: "advanced"
5546
5900
  },
5547
5901
  extract: {
5548
5902
  excerpts: false,
@@ -5557,13 +5911,11 @@ var parallelImplementation = {
5557
5911
  async search(query2, maxResults, config, context, options) {
5558
5912
  const client = createClient6(config);
5559
5913
  const defaults = asJsonObject(config.options?.search) ?? {};
5560
- const response = await client.beta.search(
5561
- {
5914
+ const response = await client.search(
5915
+ buildParallelSearchParams(query2, maxResults, {
5562
5916
  ...defaults,
5563
- ...options ?? {},
5564
- objective: query2,
5565
- max_results: maxResults
5566
- },
5917
+ ...options ?? {}
5918
+ }),
5567
5919
  buildRequestOptions3(context)
5568
5920
  );
5569
5921
  return {
@@ -5578,12 +5930,11 @@ var parallelImplementation = {
5578
5930
  async contents(urls, config, context, options) {
5579
5931
  const client = createClient6(config);
5580
5932
  const defaults = asJsonObject(config.options?.extract) ?? {};
5581
- const response = await client.beta.extract(
5582
- {
5933
+ const response = await client.extract(
5934
+ buildParallelExtractParams(urls, {
5583
5935
  ...defaults,
5584
- ...options ?? {},
5585
- urls
5586
- },
5936
+ ...options ?? {}
5937
+ }),
5587
5938
  buildRequestOptions3(context)
5588
5939
  );
5589
5940
  const resultsByUrl = new Map(
@@ -5615,6 +5966,62 @@ var parallelImplementation = {
5615
5966
  };
5616
5967
  }
5617
5968
  };
5969
+ function buildParallelSearchParams(query2, maxResults, options) {
5970
+ const {
5971
+ advanced_settings: advancedSettingsValue,
5972
+ max_results: _legacyMaxResults,
5973
+ mode: modeValue,
5974
+ objective: objectiveValue,
5975
+ search_queries: _searchQueries,
5976
+ ...rest
5977
+ } = options;
5978
+ const advancedSettings = readObjectOption(advancedSettingsValue);
5979
+ const mode = normalizeParallelSearchMode(modeValue);
5980
+ const objective = typeof objectiveValue === "string" && objectiveValue.trim() ? objectiveValue.trim() : query2;
5981
+ return {
5982
+ ...rest,
5983
+ search_queries: [query2],
5984
+ objective,
5985
+ ...mode ? { mode } : {},
5986
+ advanced_settings: {
5987
+ ...advancedSettings,
5988
+ max_results: maxResults
5989
+ }
5990
+ };
5991
+ }
5992
+ function buildParallelExtractParams(urls, options) {
5993
+ const {
5994
+ advanced_settings: advancedSettingsValue,
5995
+ excerpts: excerptsValue,
5996
+ full_content: fullContentValue,
5997
+ ...rest
5998
+ } = options;
5999
+ const advancedSettings = readObjectOption(advancedSettingsValue);
6000
+ if (typeof fullContentValue === "boolean") {
6001
+ advancedSettings.full_content = fullContentValue;
6002
+ }
6003
+ if (typeof excerptsValue === "boolean" && advancedSettings.excerpt_settings === void 0) {
6004
+ advancedSettings.excerpt_settings = excerptsValue ? {} : { max_chars_per_result: 0 };
6005
+ }
6006
+ return {
6007
+ ...rest,
6008
+ urls,
6009
+ advanced_settings: advancedSettings
6010
+ };
6011
+ }
6012
+ function normalizeParallelSearchMode(value) {
6013
+ switch (value) {
6014
+ case "advanced":
6015
+ case "basic":
6016
+ case "turbo":
6017
+ return value;
6018
+ default:
6019
+ return void 0;
6020
+ }
6021
+ }
6022
+ function readObjectOption(value) {
6023
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? { ...value } : {};
6024
+ }
5618
6025
  function createClient6(config) {
5619
6026
  const apiKey = resolveConfigValue(config.credentials?.api);
5620
6027
  if (!apiKey) {
@@ -5645,6 +6052,7 @@ var parallelProvider = defineProvider({
5645
6052
  capabilities: {
5646
6053
  search: defineCapability({
5647
6054
  options: parallelImplementation.getToolOptionsSchema?.("search"),
6055
+ promptGuidelines: parallelSearchPromptGuidelines,
5648
6056
  async execute(input, ctx) {
5649
6057
  const { query: query2, maxResults, options } = input;
5650
6058
  return await parallelImplementation.search(
@@ -5696,6 +6104,12 @@ var perplexitySearchOptionsSchema = Type12.Object(
5696
6104
  },
5697
6105
  { description: "Perplexity search options." }
5698
6106
  );
6107
+ var perplexitySearchPromptGuidelines = [
6108
+ "Use Perplexity search for concise web result retrieval with recency and domain filters, not for synthesized answers.",
6109
+ "Set search_recency_filter when freshness matters, such as breaking news, recently updated documentation, prices, or current events.",
6110
+ "Set search_domain_filter when the user asks for primary sources, official documentation, or domain-scoped retrieval.",
6111
+ "Use web_answer or web_research with Perplexity when the user wants synthesis rather than a list of candidate sources."
6112
+ ];
5699
6113
  var perplexityAnswerOptionsSchema = Type12.Object(
5700
6114
  {
5701
6115
  model: Type12.Optional(
@@ -5965,6 +6379,7 @@ var perplexityProvider = defineProvider({
5965
6379
  capabilities: {
5966
6380
  search: defineCapability({
5967
6381
  options: perplexityImplementation.getToolOptionsSchema?.("search"),
6382
+ promptGuidelines: perplexitySearchPromptGuidelines,
5968
6383
  async execute(input, ctx) {
5969
6384
  const { query: query2, maxResults, options } = input;
5970
6385
  return await perplexityImplementation.search(
@@ -6693,6 +7108,12 @@ var tavilySearchOptionsSchema = Type14.Object(
6693
7108
  },
6694
7109
  { description: "Tavily search options." }
6695
7110
  );
7111
+ var tavilySearchPromptGuidelines = [
7112
+ "Use Tavily topic='news' for recent journalism or current events and topic='finance' for market or company-finance research; otherwise leave topic as general.",
7113
+ "Use searchDepth='advanced' for broader or higher-recall source discovery, and 'basic' for quick direct lookups.",
7114
+ "Set timeRange, days, or country when the user asks for freshness, recency, or geography-specific results.",
7115
+ "Set includeRawContent or includeAnswer only when the search response itself should carry more context; prefer web_contents for selected source inspection."
7116
+ ];
6696
7117
  var tavilyExtractOptionsSchema = Type14.Object(
6697
7118
  {
6698
7119
  extractDepth: Type14.Optional(
@@ -6854,6 +7275,7 @@ var tavilyProvider = defineProvider({
6854
7275
  capabilities: {
6855
7276
  search: defineCapability({
6856
7277
  options: tavilyImplementation.getToolOptionsSchema?.("search"),
7278
+ promptGuidelines: tavilySearchPromptGuidelines,
6857
7279
  async execute(input, ctx) {
6858
7280
  const { query: query2, maxResults, options } = input;
6859
7281
  return await tavilyImplementation.search(
@@ -6896,32 +7318,230 @@ var valyuSearchOptionsSchema = Type15.Object(
6896
7318
  ),
6897
7319
  countryCode: Type15.Optional(
6898
7320
  Type15.String({ description: "Country code to scope search results." })
7321
+ ),
7322
+ maxPrice: Type15.Optional(
7323
+ Type15.Number({
7324
+ minimum: 0,
7325
+ description: "Maximum price per thousand characters (CPM)."
7326
+ })
7327
+ ),
7328
+ relevanceThreshold: Type15.Optional(
7329
+ Type15.Number({
7330
+ minimum: 0,
7331
+ maximum: 1,
7332
+ description: "Minimum result relevance score."
7333
+ })
7334
+ ),
7335
+ includedSources: Type15.Optional(
7336
+ Type15.Array(Type15.String(), {
7337
+ description: "Restrict retrieval to these Valyu sources."
7338
+ })
7339
+ ),
7340
+ excludeSources: Type15.Optional(
7341
+ Type15.Array(Type15.String(), {
7342
+ description: "Exclude these Valyu sources."
7343
+ })
7344
+ ),
7345
+ sourceBiases: Type15.Optional(
7346
+ Type15.Record(Type15.String(), Type15.Number(), {
7347
+ description: "Per-source relevance bias weights."
7348
+ })
7349
+ ),
7350
+ category: Type15.Optional(
7351
+ Type15.String({ description: "Valyu source category to search." })
7352
+ ),
7353
+ startDate: Type15.Optional(
7354
+ Type15.String({ description: "ISO date string for earliest result date." })
7355
+ ),
7356
+ endDate: Type15.Optional(
7357
+ Type15.String({ description: "ISO date string for latest result date." })
7358
+ ),
7359
+ historicalCache: Type15.Optional(
7360
+ Type15.Boolean({
7361
+ description: "Allow Valyu historical cache usage when supported."
7362
+ })
7363
+ ),
7364
+ fastMode: Type15.Optional(
7365
+ Type15.Boolean({
7366
+ description: "Use Valyu fast mode when lower latency is preferred."
7367
+ })
7368
+ ),
7369
+ urlOnly: Type15.Optional(
7370
+ Type15.Boolean({
7371
+ description: "Return URL-focused results with less content."
7372
+ })
7373
+ ),
7374
+ instructions: Type15.Optional(
7375
+ Type15.String({
7376
+ description: "Provider instructions for retrieval and result selection."
7377
+ })
6899
7378
  )
6900
7379
  },
6901
7380
  { description: "Valyu search options." }
6902
7381
  );
6903
- var valyuAnswerOptionsSchema = Type15.Object(
7382
+ var valyuSearchPromptGuidelines = [
7383
+ "Use Valyu searchType='news' for recent journalism or current events, 'web' for public web results, and 'proprietary' when proprietary Valyu sources are required.",
7384
+ "Use includedSources, excludeSources, category, or source biases from configuration when the user asks for source-specific retrieval.",
7385
+ "Use startDate/endDate and countryCode when the task requires temporal or geographic scoping.",
7386
+ "Set responseLength higher only when search results need richer inline context; otherwise prefer concise results and follow up with web_contents."
7387
+ ];
7388
+ var valyuContentsOptionsSchema = Type15.Object(
6904
7389
  {
7390
+ summary: Type15.Optional(
7391
+ Type15.Union(
7392
+ [Type15.Boolean(), Type15.String(), Type15.Record(Type15.String(), Type15.Any())],
7393
+ {
7394
+ description: "Whether to include a summary, or instructions for the summary."
7395
+ }
7396
+ )
7397
+ ),
7398
+ extractEffort: Type15.Optional(
7399
+ literalUnion(["normal", "high", "auto"], {
7400
+ description: "Extraction effort. Use 'high' for difficult pages and 'normal' for faster extraction."
7401
+ })
7402
+ ),
6905
7403
  responseLength: Type15.Optional(
6906
- literalUnion(["short", "medium", "large", "max"], {
6907
- description: "Response length for answers."
7404
+ Type15.Union(
7405
+ [
7406
+ literalUnion(["short", "medium", "large", "max"]),
7407
+ Type15.Number({ minimum: 0 })
7408
+ ],
7409
+ {
7410
+ description: "Content response length."
7411
+ }
7412
+ )
7413
+ ),
7414
+ maxPriceDollars: Type15.Optional(
7415
+ Type15.Number({
7416
+ minimum: 0,
7417
+ description: "Maximum extraction cost in USD."
7418
+ })
7419
+ ),
7420
+ screenshot: Type15.Optional(
7421
+ Type15.Boolean({
7422
+ description: "Include screenshot capture when supported."
7423
+ })
7424
+ ),
7425
+ startDate: Type15.Optional(
7426
+ Type15.String({
7427
+ description: "ISO date string for earliest content date."
7428
+ })
7429
+ ),
7430
+ endDate: Type15.Optional(
7431
+ Type15.String({ description: "ISO date string for latest content date." })
7432
+ ),
7433
+ historicalCache: Type15.Optional(
7434
+ Type15.Boolean({
7435
+ description: "Allow Valyu historical cache usage when supported."
7436
+ })
7437
+ )
7438
+ },
7439
+ { description: "Valyu contents options." }
7440
+ );
7441
+ var valyuAnswerOptionsSchema = Type15.Object(
7442
+ {
7443
+ structuredOutput: Type15.Optional(
7444
+ Type15.Record(Type15.String(), Type15.Any(), {
7445
+ description: "JSON schema-like structured output specification."
7446
+ })
7447
+ ),
7448
+ systemInstructions: Type15.Optional(
7449
+ Type15.String({
7450
+ description: "System instructions that guide Valyu answer generation."
7451
+ })
7452
+ ),
7453
+ searchType: Type15.Optional(
7454
+ literalUnion(["all", "web", "proprietary", "news"], {
7455
+ description: "Valyu search type for answer grounding."
7456
+ })
7457
+ ),
7458
+ dataMaxPrice: Type15.Optional(
7459
+ Type15.Number({
7460
+ minimum: 0,
7461
+ description: "Maximum data retrieval price for answer grounding."
6908
7462
  })
6909
7463
  ),
6910
7464
  countryCode: Type15.Optional(
6911
7465
  Type15.String({ description: "Country code to scope answer results." })
7466
+ ),
7467
+ includedSources: Type15.Optional(
7468
+ Type15.Array(Type15.String(), {
7469
+ description: "Restrict answer grounding to these Valyu sources."
7470
+ })
7471
+ ),
7472
+ excludedSources: Type15.Optional(
7473
+ Type15.Array(Type15.String(), {
7474
+ description: "Exclude these Valyu sources from answer grounding."
7475
+ })
7476
+ ),
7477
+ startDate: Type15.Optional(
7478
+ Type15.String({ description: "ISO date string for earliest source date." })
7479
+ ),
7480
+ endDate: Type15.Optional(
7481
+ Type15.String({ description: "ISO date string for latest source date." })
7482
+ ),
7483
+ fastMode: Type15.Optional(
7484
+ Type15.Boolean({
7485
+ description: "Use Valyu fast mode when lower latency is preferred."
7486
+ })
6912
7487
  )
6913
7488
  },
6914
7489
  { description: "Valyu answer options." }
6915
7490
  );
6916
7491
  var valyuResearchOptionsSchema = Type15.Object(
6917
7492
  {
6918
- responseLength: Type15.Optional(
6919
- literalUnion(["short", "medium", "large", "max"], {
6920
- description: "Response length for research."
7493
+ mode: Type15.Optional(
7494
+ literalUnion(["fast", "standard", "lite", "heavy", "max"], {
7495
+ description: "Valyu deep research mode."
6921
7496
  })
6922
7497
  ),
6923
- countryCode: Type15.Optional(
6924
- Type15.String({ description: "Country code to scope research results." })
7498
+ outputFormats: Type15.Optional(
7499
+ Type15.Array(
7500
+ Type15.Union([
7501
+ literalUnion(["markdown", "pdf", "toon"]),
7502
+ Type15.Record(Type15.String(), Type15.Any())
7503
+ ]),
7504
+ { description: "Requested Valyu research output formats." }
7505
+ )
7506
+ ),
7507
+ search: Type15.Optional(
7508
+ Type15.Object(
7509
+ {
7510
+ searchType: Type15.Optional(
7511
+ literalUnion(["all", "web", "proprietary"], {
7512
+ description: "Valyu source pool for research."
7513
+ })
7514
+ ),
7515
+ includedSources: Type15.Optional(Type15.Array(Type15.String())),
7516
+ excludedSources: Type15.Optional(Type15.Array(Type15.String())),
7517
+ sourceBiases: Type15.Optional(
7518
+ Type15.Record(Type15.String(), Type15.Number())
7519
+ ),
7520
+ startDate: Type15.Optional(Type15.String()),
7521
+ endDate: Type15.Optional(Type15.String()),
7522
+ historicalCache: Type15.Optional(Type15.Boolean()),
7523
+ category: Type15.Optional(Type15.String()),
7524
+ countryCode: Type15.Optional(Type15.String())
7525
+ },
7526
+ {
7527
+ additionalProperties: false,
7528
+ description: "Valyu deep research search configuration."
7529
+ }
7530
+ )
7531
+ ),
7532
+ tools: Type15.Optional(
7533
+ Type15.Object(
7534
+ {
7535
+ code_execution: Type15.Optional(boolOrConfig()),
7536
+ screenshots: Type15.Optional(boolOrConfig()),
7537
+ browser_use: Type15.Optional(boolOrConfig()),
7538
+ charts: Type15.Optional(boolOrConfig())
7539
+ },
7540
+ {
7541
+ additionalProperties: false,
7542
+ description: "Valyu deep research tool configuration."
7543
+ }
7544
+ )
6925
7545
  )
6926
7546
  },
6927
7547
  { description: "Valyu research options." }
@@ -6934,6 +7554,8 @@ var valyuImplementation = {
6934
7554
  switch (capability) {
6935
7555
  case "search":
6936
7556
  return valyuSearchOptionsSchema;
7557
+ case "contents":
7558
+ return valyuContentsOptionsSchema;
6937
7559
  case "answer":
6938
7560
  return valyuAnswerOptionsSchema;
6939
7561
  case "research":
@@ -6981,7 +7603,10 @@ var valyuImplementation = {
6981
7603
  },
6982
7604
  async contents(urls, config, _context, options) {
6983
7605
  const client = createClient9(config);
6984
- const response = await client.contents(urls, options);
7606
+ const response = await client.contents(urls, {
7607
+ ...asJsonObject(config.options?.contents) ?? {},
7608
+ ...options ?? {}
7609
+ });
6985
7610
  const finalResponse = "jobId" in response ? await client.waitForJob(response.jobId, {}) : response;
6986
7611
  if (!finalResponse.success) {
6987
7612
  throw new Error(finalResponse.error || "contents failed");
@@ -7127,7 +7752,7 @@ var valyuProvider = defineProvider({
7127
7752
  config: {
7128
7753
  createTemplate: () => valyuImplementation.createTemplate(),
7129
7754
  fields: ["credentials", "baseUrl", "options", "settings"],
7130
- optionCapabilities: ["search", "answer", "research"]
7755
+ optionCapabilities: ["search", "contents", "answer", "research"]
7131
7756
  },
7132
7757
  getCapabilityStatus: (config, cwd, tool, options) => valyuImplementation.getCapabilityStatus(
7133
7758
  config,
@@ -7138,6 +7763,7 @@ var valyuProvider = defineProvider({
7138
7763
  capabilities: {
7139
7764
  search: defineCapability({
7140
7765
  options: valyuImplementation.getToolOptionsSchema?.("search"),
7766
+ promptGuidelines: valyuSearchPromptGuidelines,
7141
7767
  async execute(input, ctx) {
7142
7768
  const { query: query2, maxResults, options } = input;
7143
7769
  return await valyuImplementation.search(
@@ -9062,9 +9688,9 @@ var PROVIDER_SETTINGS = {
9062
9688
  "hybrid",
9063
9689
  "fast",
9064
9690
  "instant",
9691
+ "deep-lite",
9065
9692
  "deep",
9066
- "deep-reasoning",
9067
- "deep-max"
9693
+ "deep-reasoning"
9068
9694
  ],
9069
9695
  getValue: (config) => readString5(getExaSearchOptions(config)?.type) ?? "default",
9070
9696
  setValue: (config, value) => {
@@ -9292,7 +9918,7 @@ var PROVIDER_SETTINGS = {
9292
9918
  id: "parallelSearchMode",
9293
9919
  label: "Search mode",
9294
9920
  help: "Parallel search mode. 'default' uses the SDK default.",
9295
- values: ["default", "agentic", "one-shot"],
9921
+ values: ["default", "advanced", "basic", "turbo"],
9296
9922
  getValue: (config) => readString5(getParallelOptions(config)?.search?.mode) ?? "default",
9297
9923
  setValue: (config, value) => {
9298
9924
  const options = ensureParallelOptions(config);
@@ -9386,27 +10012,19 @@ var PROVIDER_SETTINGS = {
9386
10012
  }
9387
10013
  }),
9388
10014
  valuesSetting({
9389
- id: "valyuAnswerResponseLength",
9390
- label: "Answer response length",
9391
- help: "Valyu answer response length. 'default' uses the SDK default.",
9392
- values: ["default", "short", "medium", "large", "max"],
9393
- getValue: (config) => readString5(
9394
- getValyuCapabilityOptions(config, "answer")?.responseLength
9395
- ) ?? "default",
9396
- setValue: (config, value) => {
9397
- setValyuResponseLength(config, "answer", value);
9398
- }
9399
- }),
9400
- valuesSetting({
9401
- id: "valyuResearchResponseLength",
9402
- label: "Research response length",
9403
- help: "Valyu research response length. 'default' uses the SDK default.",
9404
- values: ["default", "short", "medium", "large", "max"],
9405
- getValue: (config) => readString5(
9406
- getValyuCapabilityOptions(config, "research")?.responseLength
9407
- ) ?? "default",
10015
+ id: "valyuResearchMode",
10016
+ label: "Research mode",
10017
+ help: "Valyu research mode. 'default' uses the SDK default.",
10018
+ values: ["default", "fast", "standard", "lite", "heavy", "max"],
10019
+ getValue: (config) => readString5(getValyuCapabilityOptions(config, "research")?.mode) ?? "default",
9408
10020
  setValue: (config, value) => {
9409
- setValyuResponseLength(config, "research", value);
10021
+ const options = ensureValyuCapabilityOptions(config, "research");
10022
+ if (value === "default") {
10023
+ delete options.mode;
10024
+ } else {
10025
+ options.mode = value;
10026
+ }
10027
+ cleanupCapabilityOptions(config, ["search", "answer", "research"]);
9410
10028
  }
9411
10029
  })
9412
10030
  ]