valyu-js 2.7.6 → 2.7.8

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.
package/dist/index.d.mts CHANGED
@@ -13,6 +13,7 @@ interface SearchResult {
13
13
  data_type?: DataType;
14
14
  date?: string;
15
15
  length: number;
16
+ price: number;
16
17
  relevance_score?: number;
17
18
  publication_date?: string;
18
19
  id?: string;
@@ -169,12 +170,26 @@ interface ExtractionMetadata {
169
170
  response_length: string;
170
171
  extract_effort: string;
171
172
  }
173
+ interface AnswerSearchResult {
174
+ title: string;
175
+ url: string;
176
+ content: string | object | any[];
177
+ description?: string;
178
+ source: string;
179
+ source_type?: string;
180
+ data_type?: DataType;
181
+ date?: string;
182
+ length: number;
183
+ relevance_score?: number;
184
+ image_url?: Record<string, string>;
185
+ abstract?: string;
186
+ }
172
187
  interface AnswerSuccessResponse {
173
188
  success: true;
174
189
  tx_id: string;
175
190
  original_query: string;
176
191
  contents: string | Record<string, any>;
177
- search_results: SearchResult[];
192
+ search_results: AnswerSearchResult[];
178
193
  search_metadata: SearchMetadata;
179
194
  ai_usage: AIUsage;
180
195
  cost: Cost;
@@ -188,7 +203,7 @@ type AnswerResponse = AnswerSuccessResponse | AnswerErrorResponse;
188
203
  type AnswerStreamChunkType = "search_results" | "content" | "metadata" | "done" | "error";
189
204
  interface AnswerStreamChunk {
190
205
  type: AnswerStreamChunkType;
191
- search_results?: SearchResult[];
206
+ search_results?: AnswerSearchResult[];
192
207
  content?: string;
193
208
  finish_reason?: string;
194
209
  tx_id?: string;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ interface SearchResult {
13
13
  data_type?: DataType;
14
14
  date?: string;
15
15
  length: number;
16
+ price: number;
16
17
  relevance_score?: number;
17
18
  publication_date?: string;
18
19
  id?: string;
@@ -169,12 +170,26 @@ interface ExtractionMetadata {
169
170
  response_length: string;
170
171
  extract_effort: string;
171
172
  }
173
+ interface AnswerSearchResult {
174
+ title: string;
175
+ url: string;
176
+ content: string | object | any[];
177
+ description?: string;
178
+ source: string;
179
+ source_type?: string;
180
+ data_type?: DataType;
181
+ date?: string;
182
+ length: number;
183
+ relevance_score?: number;
184
+ image_url?: Record<string, string>;
185
+ abstract?: string;
186
+ }
172
187
  interface AnswerSuccessResponse {
173
188
  success: true;
174
189
  tx_id: string;
175
190
  original_query: string;
176
191
  contents: string | Record<string, any>;
177
- search_results: SearchResult[];
192
+ search_results: AnswerSearchResult[];
178
193
  search_metadata: SearchMetadata;
179
194
  ai_usage: AIUsage;
180
195
  cost: Cost;
@@ -188,7 +203,7 @@ type AnswerResponse = AnswerSuccessResponse | AnswerErrorResponse;
188
203
  type AnswerStreamChunkType = "search_results" | "content" | "metadata" | "done" | "error";
189
204
  interface AnswerStreamChunk {
190
205
  type: AnswerStreamChunkType;
191
- search_results?: SearchResult[];
206
+ search_results?: AnswerSearchResult[];
192
207
  content?: string;
193
208
  finish_reason?: string;
194
209
  tx_id?: string;
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
  var import_crypto = require("crypto");
38
38
  var import_axios = __toESM(require("axios"));
39
+ var SDK_VERSION = "2.7.7";
39
40
  function normalizeContentsJobResponse(api) {
40
41
  return {
41
42
  success: api.success ?? true,
@@ -85,7 +86,10 @@ var Valyu = class {
85
86
  this.baseUrl = baseUrl;
86
87
  this.headers = {
87
88
  "Content-Type": "application/json",
88
- "x-api-key": apiKey
89
+ "x-api-key": apiKey,
90
+ "User-Agent": `valyu-js/${SDK_VERSION}`,
91
+ "X-Valyu-SDK": "valyu-js",
92
+ "X-Valyu-SDK-Version": SDK_VERSION
89
93
  };
90
94
  this.deepresearch = {
91
95
  create: this._deepresearchCreate.bind(this),
@@ -1012,7 +1016,11 @@ var Valyu = class {
1012
1016
  if (options.token) {
1013
1017
  params.append("token", options.token);
1014
1018
  }
1015
- const headers = {};
1019
+ const headers = {
1020
+ "User-Agent": `valyu-js/${SDK_VERSION}`,
1021
+ "X-Valyu-SDK": "valyu-js",
1022
+ "X-Valyu-SDK-Version": SDK_VERSION
1023
+ };
1016
1024
  if (!options.token) {
1017
1025
  headers["x-api-key"] = this.headers["x-api-key"];
1018
1026
  }