diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 7d9b009..78e7f27 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.10.0"
+ ".": "0.11.0"
}
diff --git a/.stats.yml b/.stats.yml
index 64eaa82..7000a67 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 36
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-c8152db455001be3f09a3bc60d63711699d2c2a4ea5f7bbc1d71726efda0fd9b.yml
-openapi_spec_hash: 97719df292ca220de5d35d36f9756b95
-config_hash: fdaf751580ba8a60e222e560847af1ac
+configured_endpoints: 40
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-ca7f807eec8b98ae96fdd0aa6844e268696ffd9219152aed652631c963626a7c.yml
+openapi_spec_hash: 85ecd2e4bb8d86a808aa03a9ada2d3c6
+config_hash: 73a926de3d35acf984c7a39bbf08c99d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d979c31..9812df4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,27 @@
# Changelog
+## 0.11.0 (2026-01-13)
+
+Full Changelog: [v0.10.0...v0.11.0](https://github.com/ContextualAI/contextual-client-node/compare/v0.10.0...v0.11.0)
+
+### Features
+
+* **api:** manual updates ([bdaa60d](https://github.com/ContextualAI/contextual-client-node/commit/bdaa60d96310fc66cb8cb43b91b763490237a389))
+
+
+### Bug Fixes
+
+* **mcp:** correct code tool API endpoint ([8c8bc54](https://github.com/ContextualAI/contextual-client-node/commit/8c8bc545d5f3d1b7ea90d2512ba3343fd0edc591))
+* **mcp:** return correct lines on typescript errors ([88e0486](https://github.com/ContextualAI/contextual-client-node/commit/88e0486bdf24efec60fb85b184c8ee2136489c19))
+
+
+### Chores
+
+* break long lines in snippets into multiline ([38b2e46](https://github.com/ContextualAI/contextual-client-node/commit/38b2e466e843ff15f6d7fb6ad34773aea6356eef))
+* **internal:** codegen related update ([d95b949](https://github.com/ContextualAI/contextual-client-node/commit/d95b9493430dac5f336186814f1d9bb49d9c605b))
+* **internal:** codegen related update ([35acc42](https://github.com/ContextualAI/contextual-client-node/commit/35acc4287fe07f405bbee43b2b9831f4ced9c492))
+* **internal:** codegen related update ([599b5e8](https://github.com/ContextualAI/contextual-client-node/commit/599b5e86fd8cdf3cc56a4300e2b5cdd4b4b34715))
+
## 0.10.0 (2025-11-11)
Full Changelog: [v0.9.0...v0.10.0](https://github.com/ContextualAI/contextual-client-node/compare/v0.9.0...v0.10.0)
diff --git a/LICENSE b/LICENSE
index 488ad4f..7f8bb61 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2025 Contextual AI
+ Copyright 2026 Contextual AI
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/api.md b/api.md
index 9962ca7..a303242 100644
--- a/api.md
+++ b/api.md
@@ -1,11 +1,21 @@
+# Shared
+
+Types:
+
+- ParsedBlock
+
# Datastores
Types:
+- ChunkingConfiguration
- CreateDatastoreResponse
- Datastore
- DatastoreMetadata
+- DatastoreParseConfiguration
+- HTMLConfiguration
- ListDatastoresResponse
+- UnstructuredDatastoreConfigModel
- DatastoreUpdateResponse
- DatastoreDeleteResponse
- DatastoreResetResponse
@@ -15,9 +25,9 @@ Methods:
- client.datastores.create({ ...params }) -> CreateDatastoreResponse
- client.datastores.update(datastoreId, { ...params }) -> DatastoreUpdateResponse
- client.datastores.list({ ...params }) -> DatastoresDatastoresPage
-- client.datastores.delete(datastoreId) -> unknown
+- client.datastores.delete(datastoreId) -> DatastoreDeleteResponse
- client.datastores.metadata(datastoreId) -> DatastoreMetadata
-- client.datastores.reset(datastoreId) -> unknown
+- client.datastores.reset(datastoreId) -> DatastoreResetResponse
## Documents
@@ -34,7 +44,7 @@ Types:
Methods:
- client.datastores.documents.list(datastoreId, { ...params }) -> DocumentMetadataDocumentsPage
-- client.datastores.documents.delete(datastoreId, documentId) -> unknown
+- client.datastores.documents.delete(datastoreId, documentId) -> DocumentDeleteResponse
- client.datastores.documents.getParseResult(datastoreId, documentId, { ...params }) -> DocumentGetParseResultResponse
- client.datastores.documents.ingest(datastoreId, { ...params }) -> IngestionResponse
- client.datastores.documents.metadata(datastoreId, documentId) -> DocumentMetadata
@@ -52,10 +62,21 @@ Methods:
- client.datastores.contents.list(datastoreId, { ...params }) -> ContentListResponsesContentsPage
- client.datastores.contents.metadata(datastoreId, contentId, { ...params }) -> ContentMetadataResponse
+## Chunks
+
+Types:
+
+- ChunkUpdateContentResponse
+
+Methods:
+
+- client.datastores.chunks.updateContent(datastoreId, contentId, { ...params }) -> ChunkUpdateContentResponse
+
# Agents
Types:
+- ACLConfig
- Agent
- AgentConfigs
- AgentMetadata
@@ -64,21 +85,25 @@ Types:
- GenerateResponseConfig
- GlobalConfig
- ListAgentsResponse
+- ReformulationConfig
- RetrievalConfig
+- TranslationConfig
- AgentUpdateResponse
- AgentDeleteResponse
- AgentMetadataResponse
- AgentResetResponse
+- AgentSaveTemplateResponse
Methods:
- client.agents.create({ ...params }) -> CreateAgentOutput
-- client.agents.update(agentId, { ...params }) -> unknown
+- client.agents.update(agentId, { ...params }) -> AgentUpdateResponse
- client.agents.list({ ...params }) -> AgentsPage
-- client.agents.delete(agentId) -> unknown
+- client.agents.delete(agentId) -> AgentDeleteResponse
- client.agents.copy(agentId) -> CreateAgentOutput
- client.agents.metadata(agentId) -> AgentMetadataResponse
- client.agents.reset(agentId) -> unknown
+- client.agents.saveTemplate(agentId, { ...params }) -> unknown
## Query
@@ -96,6 +121,17 @@ Methods:
- client.agents.query.metrics(agentId, { ...params }) -> QueryMetricsResponse
- client.agents.query.retrievalInfo(agentId, messageId, { ...params }) -> RetrievalInfoResponse
+## Templates
+
+Types:
+
+- TemplateListResponse
+
+Methods:
+
+- client.agents.templates.retrieve(template) -> AgentMetadata
+- client.agents.templates.list() -> TemplateListResponse
+
# Users
Types:
diff --git a/package.json b/package.json
index 28494c8..5bd41d6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "contextual-client",
- "version": "0.10.0",
+ "version": "0.11.0",
"description": "The official TypeScript library for the Contextual AI API",
"author": "Contextual AI ",
"types": "dist/index.d.ts",
diff --git a/src/index.ts b/src/index.ts
index a8b7138..c49282b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -46,6 +46,7 @@ import {
Users,
} from './resources/users';
import {
+ ACLConfig,
Agent as AgentsAPIAgent,
AgentConfigs,
AgentCreateParams,
@@ -54,6 +55,8 @@ import {
AgentMetadata,
AgentMetadataResponse,
AgentResetResponse,
+ AgentSaveTemplateParams,
+ AgentSaveTemplateResponse,
AgentUpdateParams,
AgentUpdateResponse,
Agents,
@@ -63,21 +66,27 @@ import {
GenerateResponseConfig,
GlobalConfig,
ListAgentsResponse,
+ ReformulationConfig,
RetrievalConfig,
+ TranslationConfig,
} from './resources/agents/agents';
import {
+ ChunkingConfiguration,
CreateDatastoreResponse,
Datastore,
DatastoreCreateParams,
DatastoreDeleteResponse,
DatastoreListParams,
DatastoreMetadata,
+ DatastoreParseConfiguration,
DatastoreResetResponse,
DatastoreUpdateParams,
DatastoreUpdateResponse,
Datastores,
DatastoresDatastoresPage,
+ HTMLConfiguration,
ListDatastoresResponse,
+ UnstructuredDatastoreConfigModel,
} from './resources/datastores/datastores';
export interface ClientOptions {
@@ -288,10 +297,14 @@ export declare namespace ContextualAI {
export {
Datastores as Datastores,
+ type ChunkingConfiguration as ChunkingConfiguration,
type CreateDatastoreResponse as CreateDatastoreResponse,
type Datastore as Datastore,
type DatastoreMetadata as DatastoreMetadata,
+ type DatastoreParseConfiguration as DatastoreParseConfiguration,
+ type HTMLConfiguration as HTMLConfiguration,
type ListDatastoresResponse as ListDatastoresResponse,
+ type UnstructuredDatastoreConfigModel as UnstructuredDatastoreConfigModel,
type DatastoreUpdateResponse as DatastoreUpdateResponse,
type DatastoreDeleteResponse as DatastoreDeleteResponse,
type DatastoreResetResponse as DatastoreResetResponse,
@@ -303,6 +316,7 @@ export declare namespace ContextualAI {
export {
Agents as Agents,
+ type ACLConfig as ACLConfig,
type AgentsAPIAgent as Agent,
type AgentConfigs as AgentConfigs,
type AgentMetadata as AgentMetadata,
@@ -311,15 +325,19 @@ export declare namespace ContextualAI {
type GenerateResponseConfig as GenerateResponseConfig,
type GlobalConfig as GlobalConfig,
type ListAgentsResponse as ListAgentsResponse,
+ type ReformulationConfig as ReformulationConfig,
type RetrievalConfig as RetrievalConfig,
+ type TranslationConfig as TranslationConfig,
type AgentUpdateResponse as AgentUpdateResponse,
type AgentDeleteResponse as AgentDeleteResponse,
type AgentMetadataResponse as AgentMetadataResponse,
type AgentResetResponse as AgentResetResponse,
+ type AgentSaveTemplateResponse as AgentSaveTemplateResponse,
AgentsPage as AgentsPage,
type AgentCreateParams as AgentCreateParams,
type AgentUpdateParams as AgentUpdateParams,
type AgentListParams as AgentListParams,
+ type AgentSaveTemplateParams as AgentSaveTemplateParams,
};
export {
@@ -364,6 +382,8 @@ export declare namespace ContextualAI {
type ParseJobResultsParams as ParseJobResultsParams,
type ParseJobsParams as ParseJobsParams,
};
+
+ export type ParsedBlock = API.ParsedBlock;
}
export { toFile, fileFromPath } from './uploads';
diff --git a/src/resources/agents/agents.ts b/src/resources/agents/agents.ts
index 3a25c68..ea292e2 100644
--- a/src/resources/agents/agents.ts
+++ b/src/resources/agents/agents.ts
@@ -15,11 +15,14 @@ import {
QueryRetrievalInfoParams,
RetrievalInfoResponse,
} from './query';
+import * as TemplatesAPI from './templates';
+import { TemplateListResponse, Templates } from './templates';
import * as DocumentsAPI from '../datastores/documents';
import { Page, type PageParams } from '../../pagination';
export class Agents extends APIResource {
query: QueryAPI.Query = new QueryAPI.Query(this._client);
+ templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
/**
* Create a new `Agent` with a specific configuration.
@@ -48,7 +51,11 @@ export class Agents extends APIResource {
*
* Fields not included in the request body will not be modified.
*/
- update(agentId: string, body: AgentUpdateParams, options?: Core.RequestOptions): Core.APIPromise {
+ update(
+ agentId: string,
+ body: AgentUpdateParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
return this._client.put(`/agents/${agentId}`, { body, ...options });
}
@@ -74,7 +81,7 @@ export class Agents extends APIResource {
* even if no other `Agent` is using them. To delete a `Datastore`, use the
* `DELETE /datastores/{datastore_id}` API.
*/
- delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise {
+ delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.delete(`/agents/${agentId}`, options);
}
@@ -99,10 +106,36 @@ export class Agents extends APIResource {
reset(agentId: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.put(`/agents/${agentId}/reset`, options);
}
+
+ /**
+ * Save Template
+ */
+ saveTemplate(
+ agentId: string,
+ body: AgentSaveTemplateParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.post(`/agents/${agentId}/template`, { body, ...options });
+ }
}
export class AgentsPage extends Page {}
+/**
+ * Captures ACL configurations for an Agent
+ */
+export interface ACLConfig {
+ /**
+ * Whether to enable ACL.
+ */
+ acl_active?: boolean;
+
+ /**
+ * The YAML file to use for ACL.
+ */
+ acl_yaml?: string;
+}
+
export interface Agent {
/**
* ID of the agent
@@ -127,7 +160,7 @@ export interface AgentConfigs {
/**
* Parameters that affect the agent's ACL workflow
*/
- acl_config?: AgentConfigs.ACLConfig;
+ acl_config?: ACLConfig;
/**
* Parameters that affect filtering and reranking of retrieved knowledge
@@ -147,7 +180,7 @@ export interface AgentConfigs {
/**
* Parameters that affect the agent's query reformulation
*/
- reformulation_config?: AgentConfigs.ReformulationConfig;
+ reformulation_config?: ReformulationConfig;
/**
* Parameters that affect how the agent retrieves from datastore(s)
@@ -157,64 +190,7 @@ export interface AgentConfigs {
/**
* Parameters that affect the agent's translation workflow
*/
- translation_config?: AgentConfigs.TranslationConfig;
-}
-
-export namespace AgentConfigs {
- /**
- * Parameters that affect the agent's ACL workflow
- */
- export interface ACLConfig {
- /**
- * Whether to enable ACL.
- */
- acl_active?: boolean;
-
- /**
- * The YAML file to use for ACL.
- */
- acl_yaml?: string;
- }
-
- /**
- * Parameters that affect the agent's query reformulation
- */
- export interface ReformulationConfig {
- /**
- * Whether to enable query decomposition.
- */
- enable_query_decomposition?: boolean;
-
- /**
- * Whether to enable query expansion.
- */
- enable_query_expansion?: boolean;
-
- /**
- * The prompt to use for query decomposition.
- */
- query_decomposition_prompt?: string;
-
- /**
- * The prompt to use for query expansion.
- */
- query_expansion_prompt?: string;
- }
-
- /**
- * Parameters that affect the agent's translation workflow
- */
- export interface TranslationConfig {
- /**
- * The confidence threshold for translation.
- */
- translate_confidence?: number;
-
- /**
- * Whether to enable translation for the agent's responses.
- */
- translate_needed?: boolean;
- }
+ translation_config?: TranslationConfig;
}
/**
@@ -458,6 +434,31 @@ export interface ListAgentsResponse {
next_cursor?: string;
}
+/**
+ * Captures Query Reformulation configurations for an Agent
+ */
+export interface ReformulationConfig {
+ /**
+ * Whether to enable query decomposition.
+ */
+ enable_query_decomposition?: boolean;
+
+ /**
+ * Whether to enable query expansion.
+ */
+ enable_query_expansion?: boolean;
+
+ /**
+ * The prompt to use for query decomposition.
+ */
+ query_decomposition_prompt?: string;
+
+ /**
+ * The prompt to use for query expansion.
+ */
+ query_expansion_prompt?: string;
+}
+
/**
* Captures Retrieval configurations for an Agent
*/
@@ -480,9 +481,24 @@ export interface RetrievalConfig {
top_k_retrieved_chunks?: number;
}
-export type AgentUpdateResponse = unknown;
+/**
+ * Captures Translation configurations for an Agent
+ */
+export interface TranslationConfig {
+ /**
+ * The confidence threshold for translation.
+ */
+ translate_confidence?: number;
+
+ /**
+ * Whether to enable translation for the agent's responses.
+ */
+ translate_needed?: boolean;
+}
+
+export interface AgentUpdateResponse {}
-export type AgentDeleteResponse = unknown;
+export interface AgentDeleteResponse {}
/**
* Response to GET Agent request
@@ -547,6 +563,8 @@ export namespace AgentMetadataResponse {
export type AgentResetResponse = unknown;
+export type AgentSaveTemplateResponse = unknown;
+
export interface AgentCreateParams {
/**
* Name of the agent
@@ -660,11 +678,20 @@ export interface AgentUpdateParams {
export interface AgentListParams extends PageParams {}
+export interface AgentSaveTemplateParams {
+ /**
+ * The name of the template
+ */
+ name: string;
+}
+
Agents.AgentsPage = AgentsPage;
Agents.Query = Query;
+Agents.Templates = Templates;
export declare namespace Agents {
export {
+ type ACLConfig as ACLConfig,
type Agent as Agent,
type AgentConfigs as AgentConfigs,
type AgentMetadata as AgentMetadata,
@@ -673,15 +700,19 @@ export declare namespace Agents {
type GenerateResponseConfig as GenerateResponseConfig,
type GlobalConfig as GlobalConfig,
type ListAgentsResponse as ListAgentsResponse,
+ type ReformulationConfig as ReformulationConfig,
type RetrievalConfig as RetrievalConfig,
+ type TranslationConfig as TranslationConfig,
type AgentUpdateResponse as AgentUpdateResponse,
type AgentDeleteResponse as AgentDeleteResponse,
type AgentMetadataResponse as AgentMetadataResponse,
type AgentResetResponse as AgentResetResponse,
+ type AgentSaveTemplateResponse as AgentSaveTemplateResponse,
AgentsPage as AgentsPage,
type AgentCreateParams as AgentCreateParams,
type AgentUpdateParams as AgentUpdateParams,
type AgentListParams as AgentListParams,
+ type AgentSaveTemplateParams as AgentSaveTemplateParams,
};
export {
@@ -695,4 +726,6 @@ export declare namespace Agents {
type QueryMetricsParams as QueryMetricsParams,
type QueryRetrievalInfoParams as QueryRetrievalInfoParams,
};
+
+ export { Templates as Templates, type TemplateListResponse as TemplateListResponse };
}
diff --git a/src/resources/agents/index.ts b/src/resources/agents/index.ts
index 06c55d7..d7b1d4d 100644
--- a/src/resources/agents/index.ts
+++ b/src/resources/agents/index.ts
@@ -3,6 +3,7 @@
export {
AgentsPage,
Agents,
+ type ACLConfig,
type Agent,
type AgentConfigs,
type AgentMetadata,
@@ -11,14 +12,18 @@ export {
type GenerateResponseConfig,
type GlobalConfig,
type ListAgentsResponse,
+ type ReformulationConfig,
type RetrievalConfig,
+ type TranslationConfig,
type AgentUpdateResponse,
type AgentDeleteResponse,
type AgentMetadataResponse,
type AgentResetResponse,
+ type AgentSaveTemplateResponse,
type AgentCreateParams,
type AgentUpdateParams,
type AgentListParams,
+ type AgentSaveTemplateParams,
} from './agents';
export {
Query,
@@ -31,3 +36,4 @@ export {
type QueryMetricsParams,
type QueryRetrievalInfoParams,
} from './query';
+export { Templates, type TemplateListResponse } from './templates';
diff --git a/src/resources/agents/templates.ts b/src/resources/agents/templates.ts
new file mode 100644
index 0000000..a405ffc
--- /dev/null
+++ b/src/resources/agents/templates.ts
@@ -0,0 +1,32 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../../resource';
+import * as Core from '../../core';
+import * as AgentsAPI from './agents';
+
+export class Templates extends APIResource {
+ /**
+ * Get Template Configuration
+ */
+ retrieve(template: string, options?: Core.RequestOptions): Core.APIPromise {
+ return this._client.get(`/agents/templates/${template}`, options);
+ }
+
+ /**
+ * Retrieve a list of all available Templates.
+ */
+ list(options?: Core.RequestOptions): Core.APIPromise {
+ return this._client.get('/agents/templates', options);
+ }
+}
+
+export interface TemplateListResponse {
+ /**
+ * List of available templates.
+ */
+ templates?: Array;
+}
+
+export declare namespace Templates {
+ export { type TemplateListResponse as TemplateListResponse };
+}
diff --git a/src/resources/datastores/chunks.ts b/src/resources/datastores/chunks.ts
new file mode 100644
index 0000000..a6877a7
--- /dev/null
+++ b/src/resources/datastores/chunks.ts
@@ -0,0 +1,35 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../../resource';
+import * as Core from '../../core';
+
+export class Chunks extends APIResource {
+ /**
+ * Edit the content of a specific chunk in a datastore. This operation updates the
+ * chunk's text content and regenerates its embeddings.
+ */
+ updateContent(
+ datastoreId: string,
+ contentId: string,
+ body: ChunkUpdateContentParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.put(`/datastores/${datastoreId}/chunks/${contentId}/content`, { body, ...options });
+ }
+}
+
+export interface ChunkUpdateContentResponse {}
+
+export interface ChunkUpdateContentParams {
+ /**
+ * The new content text for the chunk
+ */
+ content: string;
+}
+
+export declare namespace Chunks {
+ export {
+ type ChunkUpdateContentResponse as ChunkUpdateContentResponse,
+ type ChunkUpdateContentParams as ChunkUpdateContentParams,
+ };
+}
diff --git a/src/resources/datastores/datastores.ts b/src/resources/datastores/datastores.ts
index 34bfe90..e6adc28 100644
--- a/src/resources/datastores/datastores.ts
+++ b/src/resources/datastores/datastores.ts
@@ -3,6 +3,8 @@
import { APIResource } from '../../resource';
import { isRequestOptions } from '../../core';
import * as Core from '../../core';
+import * as ChunksAPI from './chunks';
+import { ChunkUpdateContentParams, ChunkUpdateContentResponse, Chunks } from './chunks';
import * as ContentsAPI from './contents';
import {
ContentListParams,
@@ -33,6 +35,7 @@ import { DatastoresPage, type DatastoresPageParams } from '../../pagination';
export class Datastores extends APIResource {
documents: DocumentsAPI.Documents = new DocumentsAPI.Documents(this._client);
contents: ContentsAPI.Contents = new ContentsAPI.Contents(this._client);
+ chunks: ChunksAPI.Chunks = new ChunksAPI.Chunks(this._client);
/**
* Create a new `Datastore`.
@@ -98,7 +101,7 @@ export class Datastores extends APIResource {
* This operation will fail with status code 400 if there is an active `Agent`
* associated with the `Datastore`.
*/
- delete(datastoreId: string, options?: Core.RequestOptions): Core.APIPromise {
+ delete(datastoreId: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.delete(`/datastores/${datastoreId}`, options);
}
@@ -114,13 +117,47 @@ export class Datastores extends APIResource {
* Reset the give `Datastore`. This operation is irreversible and it deletes all
* the documents associated with the datastore.
*/
- reset(datastoreId: string, options?: Core.RequestOptions): Core.APIPromise {
+ reset(datastoreId: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.put(`/datastores/${datastoreId}/reset`, options);
}
}
export class DatastoresDatastoresPage extends DatastoresPage {}
+/**
+ * Configuration for document chunking settings.
+ */
+export interface ChunkingConfiguration {
+ /**
+ * Chunking mode to use. Options are: `hierarchy_depth`, `hierarchy_heading`,
+ * `static_length`, `page_level`. `hierarchy_depth` groups chunks of the same
+ * hierarchy level or below, additionally merging or splitting based on length
+ * constraints. `hierarchy_heading` splits chunks at every heading in the document
+ * hierarchy, additionally merging or splitting based on length constraints.
+ * `static_length` creates chunks of a fixed length. `page_level` creates chunks
+ * that cannot run over page boundaries.
+ */
+ chunking_mode?: 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level';
+
+ /**
+ * Whether to enable section-based contextualization for chunking
+ */
+ enable_hierarchy_based_contextualization?: boolean;
+
+ /**
+ * Target maximum length of text tokens chunks for chunking. Chunk length may
+ * exceed this value in some edge cases.
+ */
+ max_chunk_length_tokens?: number;
+
+ /**
+ * Target minimum length of chunks in tokens. Must be at least 384 tokens less than
+ * `max_chunk_length_tokens`. Chunk length may be shorter than this value in some
+ * edge cases. Ignored if `chunking_mode` is `page_level`.
+ */
+ min_chunk_length_tokens?: number;
+}
+
export interface CreateDatastoreResponse {
/**
* ID of the datastore
@@ -155,109 +192,7 @@ export interface Datastore {
/**
* Configuration of the datastore
*/
- configuration?: Datastore.Configuration;
-}
-
-export namespace Datastore {
- /**
- * Configuration of the datastore
- */
- export interface Configuration {
- /**
- * Configuration for document chunking
- */
- chunking?: Configuration.Chunking;
-
- /**
- * Configuration for HTML Extraction
- */
- html_config?: Configuration.HTMLConfig;
-
- /**
- * Configuration for document parsing
- */
- parsing?: Configuration.Parsing;
- }
-
- export namespace Configuration {
- /**
- * Configuration for document chunking
- */
- export interface Chunking {
- /**
- * Chunking mode to use. Options are: `hierarchy_depth`, `hierarchy_heading`,
- * `static_length`, `page_level`. `hierarchy_depth` groups chunks of the same
- * hierarchy level or below, additionally merging or splitting based on length
- * constraints. `hierarchy_heading` splits chunks at every heading in the document
- * hierarchy, additionally merging or splitting based on length constraints.
- * `static_length` creates chunks of a fixed length. `page_level` creates chunks
- * that cannot run over page boundaries.
- */
- chunking_mode?: 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level';
-
- /**
- * Whether to enable section-based contextualization for chunking
- */
- enable_hierarchy_based_contextualization?: boolean;
-
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
-
- /**
- * Target minimum length of chunks in tokens. Must be at least 384 tokens less than
- * `max_chunk_length_tokens`. Chunk length may be shorter than this value in some
- * edge cases. Ignored if `chunking_mode` is `page_level`.
- */
- min_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for HTML Extraction
- */
- export interface HTMLConfig {
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for document parsing
- */
- export interface Parsing {
- /**
- * Whether to enable table splitting, which splits large tables into smaller tables
- * with at most `max_split_table_cells` cells each. In each split table, the table
- * headers are reproduced as the first row(s). This is useful for preserving
- * context when tables are too large to fit into one chunk.
- */
- enable_split_tables?: boolean;
-
- /**
- * Mode for figure captioning. Options are `default`, `custom`, or `ignore`. Set to
- * `ignore` to disable figure captioning. Set to `default` to use the default
- * figure prompt, which generates a detailed caption for each figure. Set to
- * `custom` to use a custom prompt.
- */
- figure_caption_mode?: 'default' | 'custom' | 'ignore';
-
- /**
- * Prompt to use for generating image captions. Must be non-empty if
- * `figure_caption_mode` is `custom`. Otherwise, must be null.
- */
- figure_captioning_prompt?: string;
-
- /**
- * Maximum number of cells for split tables. Ignored if `enable_split_tables` is
- * False.
- */
- max_split_table_cells?: number;
- }
- }
+ configuration?: UnstructuredDatastoreConfigModel;
}
export interface DatastoreMetadata {
@@ -279,7 +214,7 @@ export interface DatastoreMetadata {
/**
* Configuration for unstructured datastores.
*/
- configuration?: DatastoreMetadata.Configuration | null;
+ configuration?: UnstructuredDatastoreConfigModel | null;
/**
* Type of the datastore
@@ -294,114 +229,60 @@ export interface DatastoreMetadata {
export namespace DatastoreMetadata {
/**
- * Configuration for unstructured datastores.
+ * Datastore usage
*/
- export interface Configuration {
- /**
- * Configuration for document chunking
- */
- chunking?: Configuration.Chunking;
-
- /**
- * Configuration for HTML Extraction
- */
- html_config?: Configuration.HTMLConfig;
-
+ export interface DatastoreUsages {
/**
- * Configuration for document parsing
+ * Actual size of the datastore in GB
*/
- parsing?: Configuration.Parsing;
+ size_gb: number;
}
+}
- export namespace Configuration {
- /**
- * Configuration for document chunking
- */
- export interface Chunking {
- /**
- * Chunking mode to use. Options are: `hierarchy_depth`, `hierarchy_heading`,
- * `static_length`, `page_level`. `hierarchy_depth` groups chunks of the same
- * hierarchy level or below, additionally merging or splitting based on length
- * constraints. `hierarchy_heading` splits chunks at every heading in the document
- * hierarchy, additionally merging or splitting based on length constraints.
- * `static_length` creates chunks of a fixed length. `page_level` creates chunks
- * that cannot run over page boundaries.
- */
- chunking_mode?: 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level';
-
- /**
- * Whether to enable section-based contextualization for chunking
- */
- enable_hierarchy_based_contextualization?: boolean;
-
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
-
- /**
- * Target minimum length of chunks in tokens. Must be at least 384 tokens less than
- * `max_chunk_length_tokens`. Chunk length may be shorter than this value in some
- * edge cases. Ignored if `chunking_mode` is `page_level`.
- */
- min_chunk_length_tokens?: number;
- }
+/**
+ * Configuration for data extraction settings from documents at datastore level.
+ * Controls settings for document parsing. Includes those from `/parse` API along
+ * with some extra ingestion-only ones.
+ */
+export interface DatastoreParseConfiguration {
+ /**
+ * Whether to enable table splitting, which splits large tables into smaller tables
+ * with at most `max_split_table_cells` cells each. In each split table, the table
+ * headers are reproduced as the first row(s). This is useful for preserving
+ * context when tables are too large to fit into one chunk.
+ */
+ enable_split_tables?: boolean;
- /**
- * Configuration for HTML Extraction
- */
- export interface HTMLConfig {
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
- }
+ /**
+ * Mode for figure captioning. Options are `default`, `custom`, or `ignore`. Set to
+ * `ignore` to disable figure captioning. Set to `default` to use the default
+ * figure prompt, which generates a detailed caption for each figure. Set to
+ * `custom` to use a custom prompt.
+ */
+ figure_caption_mode?: 'default' | 'custom' | 'ignore';
- /**
- * Configuration for document parsing
- */
- export interface Parsing {
- /**
- * Whether to enable table splitting, which splits large tables into smaller tables
- * with at most `max_split_table_cells` cells each. In each split table, the table
- * headers are reproduced as the first row(s). This is useful for preserving
- * context when tables are too large to fit into one chunk.
- */
- enable_split_tables?: boolean;
-
- /**
- * Mode for figure captioning. Options are `default`, `custom`, or `ignore`. Set to
- * `ignore` to disable figure captioning. Set to `default` to use the default
- * figure prompt, which generates a detailed caption for each figure. Set to
- * `custom` to use a custom prompt.
- */
- figure_caption_mode?: 'default' | 'custom' | 'ignore';
-
- /**
- * Prompt to use for generating image captions. Must be non-empty if
- * `figure_caption_mode` is `custom`. Otherwise, must be null.
- */
- figure_captioning_prompt?: string;
-
- /**
- * Maximum number of cells for split tables. Ignored if `enable_split_tables` is
- * False.
- */
- max_split_table_cells?: number;
- }
- }
+ /**
+ * Prompt to use for generating image captions. Must be non-empty if
+ * `figure_caption_mode` is `custom`. Otherwise, must be null.
+ */
+ figure_captioning_prompt?: string;
/**
- * Datastore usage
+ * Maximum number of cells for split tables. Ignored if `enable_split_tables` is
+ * False.
*/
- export interface DatastoreUsages {
- /**
- * Actual size of the datastore in GB
- */
- size_gb: number;
- }
+ max_split_table_cells?: number;
+}
+
+/**
+ * Configuration for HTML document ingestion settings.
+ */
+export interface HTMLConfiguration {
+ /**
+ * Target maximum length of text tokens chunks for chunking. Chunk length may
+ * exceed this value in some edge cases.
+ */
+ max_chunk_length_tokens?: number;
}
export interface ListDatastoresResponse {
@@ -422,6 +303,26 @@ export interface ListDatastoresResponse {
next_cursor?: string;
}
+/**
+ * Configuration for unstructured datastores.
+ */
+export interface UnstructuredDatastoreConfigModel {
+ /**
+ * Configuration for document chunking
+ */
+ chunking?: ChunkingConfiguration;
+
+ /**
+ * Configuration for HTML Extraction
+ */
+ html_config?: HTMLConfiguration;
+
+ /**
+ * Configuration for document parsing
+ */
+ parsing?: DatastoreParseConfiguration;
+}
+
export interface DatastoreUpdateResponse {
/**
* ID of the datastore
@@ -429,9 +330,9 @@ export interface DatastoreUpdateResponse {
id: string;
}
-export type DatastoreDeleteResponse = unknown;
+export interface DatastoreDeleteResponse {}
-export type DatastoreResetResponse = unknown;
+export interface DatastoreResetResponse {}
export interface DatastoreCreateParams {
/**
@@ -442,109 +343,7 @@ export interface DatastoreCreateParams {
/**
* Configuration of the datastore. If not provided, default configuration is used.
*/
- configuration?: DatastoreCreateParams.Configuration;
-}
-
-export namespace DatastoreCreateParams {
- /**
- * Configuration of the datastore. If not provided, default configuration is used.
- */
- export interface Configuration {
- /**
- * Configuration for document chunking
- */
- chunking?: Configuration.Chunking;
-
- /**
- * Configuration for HTML Extraction
- */
- html_config?: Configuration.HTMLConfig;
-
- /**
- * Configuration for document parsing
- */
- parsing?: Configuration.Parsing;
- }
-
- export namespace Configuration {
- /**
- * Configuration for document chunking
- */
- export interface Chunking {
- /**
- * Chunking mode to use. Options are: `hierarchy_depth`, `hierarchy_heading`,
- * `static_length`, `page_level`. `hierarchy_depth` groups chunks of the same
- * hierarchy level or below, additionally merging or splitting based on length
- * constraints. `hierarchy_heading` splits chunks at every heading in the document
- * hierarchy, additionally merging or splitting based on length constraints.
- * `static_length` creates chunks of a fixed length. `page_level` creates chunks
- * that cannot run over page boundaries.
- */
- chunking_mode?: 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level';
-
- /**
- * Whether to enable section-based contextualization for chunking
- */
- enable_hierarchy_based_contextualization?: boolean;
-
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
-
- /**
- * Target minimum length of chunks in tokens. Must be at least 384 tokens less than
- * `max_chunk_length_tokens`. Chunk length may be shorter than this value in some
- * edge cases. Ignored if `chunking_mode` is `page_level`.
- */
- min_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for HTML Extraction
- */
- export interface HTMLConfig {
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for document parsing
- */
- export interface Parsing {
- /**
- * Whether to enable table splitting, which splits large tables into smaller tables
- * with at most `max_split_table_cells` cells each. In each split table, the table
- * headers are reproduced as the first row(s). This is useful for preserving
- * context when tables are too large to fit into one chunk.
- */
- enable_split_tables?: boolean;
-
- /**
- * Mode for figure captioning. Options are `default`, `custom`, or `ignore`. Set to
- * `ignore` to disable figure captioning. Set to `default` to use the default
- * figure prompt, which generates a detailed caption for each figure. Set to
- * `custom` to use a custom prompt.
- */
- figure_caption_mode?: 'default' | 'custom' | 'ignore';
-
- /**
- * Prompt to use for generating image captions. Must be non-empty if
- * `figure_caption_mode` is `custom`. Otherwise, must be null.
- */
- figure_captioning_prompt?: string;
-
- /**
- * Maximum number of cells for split tables. Ignored if `enable_split_tables` is
- * False.
- */
- max_split_table_cells?: number;
- }
- }
+ configuration?: UnstructuredDatastoreConfigModel;
}
export interface DatastoreUpdateParams {
@@ -552,7 +351,7 @@ export interface DatastoreUpdateParams {
* Configuration of the datastore. If not provided, current configuration is
* retained.
*/
- configuration?: DatastoreUpdateParams.Configuration;
+ configuration?: UnstructuredDatastoreConfigModel;
/**
* Name of the datastore
@@ -560,109 +359,6 @@ export interface DatastoreUpdateParams {
name?: string;
}
-export namespace DatastoreUpdateParams {
- /**
- * Configuration of the datastore. If not provided, current configuration is
- * retained.
- */
- export interface Configuration {
- /**
- * Configuration for document chunking
- */
- chunking?: Configuration.Chunking;
-
- /**
- * Configuration for HTML Extraction
- */
- html_config?: Configuration.HTMLConfig;
-
- /**
- * Configuration for document parsing
- */
- parsing?: Configuration.Parsing;
- }
-
- export namespace Configuration {
- /**
- * Configuration for document chunking
- */
- export interface Chunking {
- /**
- * Chunking mode to use. Options are: `hierarchy_depth`, `hierarchy_heading`,
- * `static_length`, `page_level`. `hierarchy_depth` groups chunks of the same
- * hierarchy level or below, additionally merging or splitting based on length
- * constraints. `hierarchy_heading` splits chunks at every heading in the document
- * hierarchy, additionally merging or splitting based on length constraints.
- * `static_length` creates chunks of a fixed length. `page_level` creates chunks
- * that cannot run over page boundaries.
- */
- chunking_mode?: 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level';
-
- /**
- * Whether to enable section-based contextualization for chunking
- */
- enable_hierarchy_based_contextualization?: boolean;
-
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
-
- /**
- * Target minimum length of chunks in tokens. Must be at least 384 tokens less than
- * `max_chunk_length_tokens`. Chunk length may be shorter than this value in some
- * edge cases. Ignored if `chunking_mode` is `page_level`.
- */
- min_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for HTML Extraction
- */
- export interface HTMLConfig {
- /**
- * Target maximum length of text tokens chunks for chunking. Chunk length may
- * exceed this value in some edge cases.
- */
- max_chunk_length_tokens?: number;
- }
-
- /**
- * Configuration for document parsing
- */
- export interface Parsing {
- /**
- * Whether to enable table splitting, which splits large tables into smaller tables
- * with at most `max_split_table_cells` cells each. In each split table, the table
- * headers are reproduced as the first row(s). This is useful for preserving
- * context when tables are too large to fit into one chunk.
- */
- enable_split_tables?: boolean;
-
- /**
- * Mode for figure captioning. Options are `default`, `custom`, or `ignore`. Set to
- * `ignore` to disable figure captioning. Set to `default` to use the default
- * figure prompt, which generates a detailed caption for each figure. Set to
- * `custom` to use a custom prompt.
- */
- figure_caption_mode?: 'default' | 'custom' | 'ignore';
-
- /**
- * Prompt to use for generating image captions. Must be non-empty if
- * `figure_caption_mode` is `custom`. Otherwise, must be null.
- */
- figure_captioning_prompt?: string;
-
- /**
- * Maximum number of cells for split tables. Ignored if `enable_split_tables` is
- * False.
- */
- max_split_table_cells?: number;
- }
- }
-}
-
export interface DatastoreListParams extends DatastoresPageParams {
/**
* ID of the agent used to filter datastores. If provided, only datastores linked
@@ -676,13 +372,18 @@ Datastores.Documents = Documents;
Datastores.DocumentMetadataDocumentsPage = DocumentMetadataDocumentsPage;
Datastores.Contents = Contents;
Datastores.ContentListResponsesContentsPage = ContentListResponsesContentsPage;
+Datastores.Chunks = Chunks;
export declare namespace Datastores {
export {
+ type ChunkingConfiguration as ChunkingConfiguration,
type CreateDatastoreResponse as CreateDatastoreResponse,
type Datastore as Datastore,
type DatastoreMetadata as DatastoreMetadata,
+ type DatastoreParseConfiguration as DatastoreParseConfiguration,
+ type HTMLConfiguration as HTMLConfiguration,
type ListDatastoresResponse as ListDatastoresResponse,
+ type UnstructuredDatastoreConfigModel as UnstructuredDatastoreConfigModel,
type DatastoreUpdateResponse as DatastoreUpdateResponse,
type DatastoreDeleteResponse as DatastoreDeleteResponse,
type DatastoreResetResponse as DatastoreResetResponse,
@@ -716,4 +417,10 @@ export declare namespace Datastores {
type ContentListParams as ContentListParams,
type ContentMetadataParams as ContentMetadataParams,
};
+
+ export {
+ Chunks as Chunks,
+ type ChunkUpdateContentResponse as ChunkUpdateContentResponse,
+ type ChunkUpdateContentParams as ChunkUpdateContentParams,
+ };
}
diff --git a/src/resources/datastores/documents.ts b/src/resources/datastores/documents.ts
index 5f9f4fb..ccbbfc5 100644
--- a/src/resources/datastores/documents.ts
+++ b/src/resources/datastores/documents.ts
@@ -3,6 +3,7 @@
import { APIResource } from '../../resource';
import { isRequestOptions } from '../../core';
import * as Core from '../../core';
+import * as Shared from '../shared';
import { DocumentsPage, type DocumentsPageParams } from '../../pagination';
export class Documents extends APIResource {
@@ -41,7 +42,11 @@ export class Documents extends APIResource {
/**
* Delete a given document from its `Datastore`. This operation is irreversible.
*/
- delete(datastoreId: string, documentId: string, options?: Core.RequestOptions): Core.APIPromise {
+ delete(
+ datastoreId: string,
+ documentId: string,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
return this._client.delete(`/datastores/${datastoreId}/documents/${documentId}`, options);
}
@@ -304,7 +309,7 @@ export interface ListDocumentsResponse {
total_count?: number;
}
-export type DocumentDeleteResponse = unknown;
+export interface DocumentDeleteResponse {}
/**
* /parse results reponse object.
@@ -359,95 +364,13 @@ export namespace DocumentGetParseResultResponse {
/**
* Heading blocks which define the hierarchy of the document
*/
- blocks?: Array;
+ blocks?: Array;
/**
* Markdown representation of the table of contents for this document
*/
table_of_contents?: string;
}
-
- export namespace Hierarchy {
- /**
- * One logical block of content from a parsed page.
- */
- export interface Block {
- /**
- * Unique ID of the block
- */
- id: string;
-
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- bounding_box: Block.BoundingBox;
-
- /**
- * The Markdown representation of the block
- */
- markdown: string;
-
- /**
- * The type of the block
- */
- type: 'heading' | 'text' | 'table' | 'figure';
-
- /**
- * The confidence level of this block categorized as 'low', 'medium', or 'high'.
- * Only available for blocks of type 'table' currently.
- */
- confidence_level?: 'low' | 'medium' | 'high';
-
- /**
- * The level of the block in the document hierarchy, starting at 0 for the
- * root-level title block. Only present if `enable_document_hierarchy` was set to
- * true in the request.
- */
- hierarchy_level?: number;
-
- /**
- * The page (0-indexed) that this block belongs to. Only set for heading blocks
- * that are returned in the table of contents.
- */
- page_index?: number;
-
- /**
- * The IDs of the parent in the document hierarchy, sorted from root-level to
- * bottom. For root-level heading blocks, this will be an empty list. Only present
- * if `enable_document_hierarchy` was set to true in the request.
- */
- parent_ids?: Array;
- }
-
- export namespace Block {
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- export interface BoundingBox {
- /**
- * The x-coordinate of the top-left corner of the bounding box
- */
- x0: number;
-
- /**
- * The x-coordinate of the bottom-right corner of the bounding box
- */
- x1: number;
-
- /**
- * The y-coordinate of the top-left corner of the bounding box
- */
- y0: number;
-
- /**
- * The y-coordinate of the bottom-right corner of the bounding box
- */
- y1: number;
- }
- }
- }
}
/**
@@ -463,7 +386,7 @@ export namespace DocumentGetParseResultResponse {
* The parsed, structured blocks of this page. Present if `blocks-per-page` was
* among the requested output types.
*/
- blocks?: Array;
+ blocks?: Array;
/**
* The parsed, structured Markdown of this page. Present if `markdown-per-page` was
@@ -471,88 +394,6 @@ export namespace DocumentGetParseResultResponse {
*/
markdown?: string;
}
-
- export namespace Page {
- /**
- * One logical block of content from a parsed page.
- */
- export interface Block {
- /**
- * Unique ID of the block
- */
- id: string;
-
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- bounding_box: Block.BoundingBox;
-
- /**
- * The Markdown representation of the block
- */
- markdown: string;
-
- /**
- * The type of the block
- */
- type: 'heading' | 'text' | 'table' | 'figure';
-
- /**
- * The confidence level of this block categorized as 'low', 'medium', or 'high'.
- * Only available for blocks of type 'table' currently.
- */
- confidence_level?: 'low' | 'medium' | 'high';
-
- /**
- * The level of the block in the document hierarchy, starting at 0 for the
- * root-level title block. Only present if `enable_document_hierarchy` was set to
- * true in the request.
- */
- hierarchy_level?: number;
-
- /**
- * The page (0-indexed) that this block belongs to. Only set for heading blocks
- * that are returned in the table of contents.
- */
- page_index?: number;
-
- /**
- * The IDs of the parent in the document hierarchy, sorted from root-level to
- * bottom. For root-level heading blocks, this will be an empty list. Only present
- * if `enable_document_hierarchy` was set to true in the request.
- */
- parent_ids?: Array;
- }
-
- export namespace Block {
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- export interface BoundingBox {
- /**
- * The x-coordinate of the top-left corner of the bounding box
- */
- x0: number;
-
- /**
- * The x-coordinate of the bottom-right corner of the bounding box
- */
- x1: number;
-
- /**
- * The y-coordinate of the top-left corner of the bounding box
- */
- y0: number;
-
- /**
- * The y-coordinate of the bottom-right corner of the bounding box
- */
- y1: number;
- }
- }
- }
}
export interface DocumentListParams extends DocumentsPageParams {
diff --git a/src/resources/datastores/index.ts b/src/resources/datastores/index.ts
index 2b28448..0116b69 100644
--- a/src/resources/datastores/index.ts
+++ b/src/resources/datastores/index.ts
@@ -1,5 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+export { Chunks, type ChunkUpdateContentResponse, type ChunkUpdateContentParams } from './chunks';
export {
ContentListResponsesContentsPage,
Contents,
@@ -11,10 +12,14 @@ export {
export {
DatastoresDatastoresPage,
Datastores,
+ type ChunkingConfiguration,
type CreateDatastoreResponse,
type Datastore,
type DatastoreMetadata,
+ type DatastoreParseConfiguration,
+ type HTMLConfiguration,
type ListDatastoresResponse,
+ type UnstructuredDatastoreConfigModel,
type DatastoreUpdateResponse,
type DatastoreDeleteResponse,
type DatastoreResetResponse,
diff --git a/src/resources/index.ts b/src/resources/index.ts
index d7d75b0..929036e 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,8 +1,10 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+export * from './shared';
export {
AgentsPage,
Agents,
+ type ACLConfig,
type Agent,
type AgentConfigs,
type AgentMetadata,
@@ -11,22 +13,30 @@ export {
type GenerateResponseConfig,
type GlobalConfig,
type ListAgentsResponse,
+ type ReformulationConfig,
type RetrievalConfig,
+ type TranslationConfig,
type AgentUpdateResponse,
type AgentDeleteResponse,
type AgentMetadataResponse,
type AgentResetResponse,
+ type AgentSaveTemplateResponse,
type AgentCreateParams,
type AgentUpdateParams,
type AgentListParams,
+ type AgentSaveTemplateParams,
} from './agents/agents';
export {
DatastoresDatastoresPage,
Datastores,
+ type ChunkingConfiguration,
type CreateDatastoreResponse,
type Datastore,
type DatastoreMetadata,
+ type DatastoreParseConfiguration,
+ type HTMLConfiguration,
type ListDatastoresResponse,
+ type UnstructuredDatastoreConfigModel,
type DatastoreUpdateResponse,
type DatastoreDeleteResponse,
type DatastoreResetResponse,
diff --git a/src/resources/parse.ts b/src/resources/parse.ts
index cffb748..59b5bec 100644
--- a/src/resources/parse.ts
+++ b/src/resources/parse.ts
@@ -3,6 +3,7 @@
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
+import * as Shared from './shared';
export class Parse extends APIResource {
/**
@@ -134,95 +135,13 @@ export namespace ParseJobResultsResponse {
/**
* Heading blocks which define the hierarchy of the document
*/
- blocks?: Array;
+ blocks?: Array;
/**
* Markdown representation of the table of contents for this document
*/
table_of_contents?: string;
}
-
- export namespace Hierarchy {
- /**
- * One logical block of content from a parsed page.
- */
- export interface Block {
- /**
- * Unique ID of the block
- */
- id: string;
-
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- bounding_box: Block.BoundingBox;
-
- /**
- * The Markdown representation of the block
- */
- markdown: string;
-
- /**
- * The type of the block
- */
- type: 'heading' | 'text' | 'table' | 'figure';
-
- /**
- * The confidence level of this block categorized as 'low', 'medium', or 'high'.
- * Only available for blocks of type 'table' currently.
- */
- confidence_level?: 'low' | 'medium' | 'high';
-
- /**
- * The level of the block in the document hierarchy, starting at 0 for the
- * root-level title block. Only present if `enable_document_hierarchy` was set to
- * true in the request.
- */
- hierarchy_level?: number;
-
- /**
- * The page (0-indexed) that this block belongs to. Only set for heading blocks
- * that are returned in the table of contents.
- */
- page_index?: number;
-
- /**
- * The IDs of the parent in the document hierarchy, sorted from root-level to
- * bottom. For root-level heading blocks, this will be an empty list. Only present
- * if `enable_document_hierarchy` was set to true in the request.
- */
- parent_ids?: Array;
- }
-
- export namespace Block {
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- export interface BoundingBox {
- /**
- * The x-coordinate of the top-left corner of the bounding box
- */
- x0: number;
-
- /**
- * The x-coordinate of the bottom-right corner of the bounding box
- */
- x1: number;
-
- /**
- * The y-coordinate of the top-left corner of the bounding box
- */
- y0: number;
-
- /**
- * The y-coordinate of the bottom-right corner of the bounding box
- */
- y1: number;
- }
- }
- }
}
/**
@@ -238,7 +157,7 @@ export namespace ParseJobResultsResponse {
* The parsed, structured blocks of this page. Present if `blocks-per-page` was
* among the requested output types.
*/
- blocks?: Array;
+ blocks?: Array;
/**
* The parsed, structured Markdown of this page. Present if `markdown-per-page` was
@@ -246,88 +165,6 @@ export namespace ParseJobResultsResponse {
*/
markdown?: string;
}
-
- export namespace Page {
- /**
- * One logical block of content from a parsed page.
- */
- export interface Block {
- /**
- * Unique ID of the block
- */
- id: string;
-
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- bounding_box: Block.BoundingBox;
-
- /**
- * The Markdown representation of the block
- */
- markdown: string;
-
- /**
- * The type of the block
- */
- type: 'heading' | 'text' | 'table' | 'figure';
-
- /**
- * The confidence level of this block categorized as 'low', 'medium', or 'high'.
- * Only available for blocks of type 'table' currently.
- */
- confidence_level?: 'low' | 'medium' | 'high';
-
- /**
- * The level of the block in the document hierarchy, starting at 0 for the
- * root-level title block. Only present if `enable_document_hierarchy` was set to
- * true in the request.
- */
- hierarchy_level?: number;
-
- /**
- * The page (0-indexed) that this block belongs to. Only set for heading blocks
- * that are returned in the table of contents.
- */
- page_index?: number;
-
- /**
- * The IDs of the parent in the document hierarchy, sorted from root-level to
- * bottom. For root-level heading blocks, this will be an empty list. Only present
- * if `enable_document_hierarchy` was set to true in the request.
- */
- parent_ids?: Array;
- }
-
- export namespace Block {
- /**
- * The normalized bounding box of the block, as relative percentages of the page
- * width and height
- */
- export interface BoundingBox {
- /**
- * The x-coordinate of the top-left corner of the bounding box
- */
- x0: number;
-
- /**
- * The x-coordinate of the bottom-right corner of the bounding box
- */
- x1: number;
-
- /**
- * The y-coordinate of the top-left corner of the bounding box
- */
- y0: number;
-
- /**
- * The y-coordinate of the bottom-right corner of the bounding box
- */
- y1: number;
- }
- }
- }
}
/**
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
new file mode 100644
index 0000000..12c7c0c
--- /dev/null
+++ b/src/resources/shared.ts
@@ -0,0 +1,81 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+/**
+ * One logical block of content from a parsed page.
+ */
+export interface ParsedBlock {
+ /**
+ * Unique ID of the block
+ */
+ id: string;
+
+ /**
+ * The normalized bounding box of the block, as relative percentages of the page
+ * width and height
+ */
+ bounding_box: ParsedBlock.BoundingBox;
+
+ /**
+ * The Markdown representation of the block
+ */
+ markdown: string;
+
+ /**
+ * The type of the block
+ */
+ type: 'heading' | 'text' | 'table' | 'figure';
+
+ /**
+ * The confidence level of this block categorized as 'low', 'medium', or 'high'.
+ * Only available for blocks of type 'table' currently.
+ */
+ confidence_level?: 'low' | 'medium' | 'high';
+
+ /**
+ * The level of the block in the document hierarchy, starting at 0 for the
+ * root-level title block. Only present if `enable_document_hierarchy` was set to
+ * true in the request.
+ */
+ hierarchy_level?: number;
+
+ /**
+ * The page (0-indexed) that this block belongs to. Only set for heading blocks
+ * that are returned in the table of contents.
+ */
+ page_index?: number;
+
+ /**
+ * The IDs of the parent in the document hierarchy, sorted from root-level to
+ * bottom. For root-level heading blocks, this will be an empty list. Only present
+ * if `enable_document_hierarchy` was set to true in the request.
+ */
+ parent_ids?: Array;
+}
+
+export namespace ParsedBlock {
+ /**
+ * The normalized bounding box of the block, as relative percentages of the page
+ * width and height
+ */
+ export interface BoundingBox {
+ /**
+ * The x-coordinate of the top-left corner of the bounding box
+ */
+ x0: number;
+
+ /**
+ * The x-coordinate of the bottom-right corner of the bounding box
+ */
+ x1: number;
+
+ /**
+ * The y-coordinate of the top-left corner of the bounding box
+ */
+ y0: number;
+
+ /**
+ * The y-coordinate of the bottom-right corner of the bounding box
+ */
+ y1: number;
+ }
+}
diff --git a/src/version.ts b/src/version.ts
index c2e5b96..9085e9d 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.10.0'; // x-release-please-version
+export const VERSION = '0.11.0'; // x-release-please-version
diff --git a/tests/api-resources/agents/agents.test.ts b/tests/api-resources/agents/agents.test.ts
index bf30c3a..f951129 100644
--- a/tests/api-resources/agents/agents.test.ts
+++ b/tests/api-resources/agents/agents.test.ts
@@ -27,12 +27,24 @@ describe('resource agents', () => {
acl_config: { acl_active: true, acl_yaml: 'acl_yaml' },
filter_and_rerank_config: {
default_metadata_filters: {
- filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
+ filters: [
+ {
+ field: 'field1',
+ operator: 'equals',
+ value: 'value1',
+ },
+ ],
operator: 'AND',
},
per_datastore_metadata_filters: {
'd49609d9-61c3-4a67-b3bd-5196b10da560': {
- filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
+ filters: [
+ {
+ field: 'field1',
+ operator: 'equals',
+ value: 'value1',
+ },
+ ],
operator: 'AND',
},
},
@@ -61,7 +73,11 @@ describe('resource agents', () => {
query_decomposition_prompt: 'query_decomposition_prompt',
query_expansion_prompt: 'query_expansion_prompt',
},
- retrieval_config: { lexical_alpha: 0, semantic_alpha: 0, top_k_retrieved_chunks: 0 },
+ retrieval_config: {
+ lexical_alpha: 0,
+ semantic_alpha: 0,
+ top_k_retrieved_chunks: 0,
+ },
translation_config: { translate_confidence: 0, translate_needed: true },
},
datastore_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
@@ -182,4 +198,23 @@ describe('resource agents', () => {
client.agents.reset('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(ContextualAI.NotFoundError);
});
+
+ test('saveTemplate: only required params', async () => {
+ const responsePromise = client.agents.saveTemplate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
+ name: 'name',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('saveTemplate: required and optional params', async () => {
+ const response = await client.agents.saveTemplate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
+ name: 'name',
+ });
+ });
});
diff --git a/tests/api-resources/agents/query.test.ts b/tests/api-resources/agents/query.test.ts
index 4b16e82..6f3c4c2 100644
--- a/tests/api-resources/agents/query.test.ts
+++ b/tests/api-resources/agents/query.test.ts
@@ -24,12 +24,24 @@ describe('resource query', () => {
test('create: required and optional params', async () => {
const response = await client.agents.query.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
- messages: [{ content: 'content', role: 'user', custom_tags: ['string'] }],
+ messages: [
+ {
+ content: 'content',
+ role: 'user',
+ custom_tags: ['string'],
+ },
+ ],
include_retrieval_content_text: true,
retrievals_only: true,
conversation_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
documents_filters: {
- filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
+ filters: [
+ {
+ field: 'field1',
+ operator: 'equals',
+ value: 'value1',
+ },
+ ],
operator: 'AND',
},
llm_model_id: 'llm_model_id',
@@ -52,7 +64,10 @@ describe('resource query', () => {
top_p: 0,
},
stream: true,
- structured_output: { json_schema: { foo: 'bar' }, type: 'JSON' },
+ structured_output: {
+ json_schema: { foo: 'bar' },
+ type: 'JSON',
+ },
});
});
diff --git a/tests/api-resources/agents/templates.test.ts b/tests/api-resources/agents/templates.test.ts
new file mode 100644
index 0000000..9bf6a6a
--- /dev/null
+++ b/tests/api-resources/agents/templates.test.ts
@@ -0,0 +1,47 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import ContextualAI from 'contextual-client';
+import { Response } from 'node-fetch';
+
+const client = new ContextualAI({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource templates', () => {
+ test('retrieve', async () => {
+ const responsePromise = client.agents.templates.retrieve('template');
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('retrieve: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ client.agents.templates.retrieve('template', { path: '/_stainless_unknown_path' }),
+ ).rejects.toThrow(ContextualAI.NotFoundError);
+ });
+
+ test('list', async () => {
+ const responsePromise = client.agents.templates.list();
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('list: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(client.agents.templates.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
+ ContextualAI.NotFoundError,
+ );
+ });
+});
diff --git a/tests/api-resources/datastores/chunks.test.ts b/tests/api-resources/datastores/chunks.test.ts
new file mode 100644
index 0000000..aed69af
--- /dev/null
+++ b/tests/api-resources/datastores/chunks.test.ts
@@ -0,0 +1,34 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import ContextualAI from 'contextual-client';
+import { Response } from 'node-fetch';
+
+const client = new ContextualAI({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource chunks', () => {
+ test('updateContent: only required params', async () => {
+ const responsePromise = client.datastores.chunks.updateContent(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { content: 'content' },
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('updateContent: required and optional params', async () => {
+ const response = await client.datastores.chunks.updateContent(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { content: 'content' },
+ );
+ });
+});
diff --git a/tests/api-resources/datastores/contents.test.ts b/tests/api-resources/datastores/contents.test.ts
index 618f096..55c0785 100644
--- a/tests/api-resources/datastores/contents.test.ts
+++ b/tests/api-resources/datastores/contents.test.ts
@@ -34,7 +34,12 @@ describe('resource contents', () => {
await expect(
client.datastores.contents.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { document_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', limit: 0, offset: 0, search: 'search' },
+ {
+ document_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ limit: 0,
+ offset: 0,
+ search: 'search',
+ },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(ContextualAI.NotFoundError);
diff --git a/tests/api-resources/datastores/datastores.test.ts b/tests/api-resources/datastores/datastores.test.ts
index 67bbf5f..debde74 100644
--- a/tests/api-resources/datastores/datastores.test.ts
+++ b/tests/api-resources/datastores/datastores.test.ts
@@ -74,7 +74,11 @@ describe('resource datastores', () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.datastores.list(
- { agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', cursor: 'cursor', limit: 1 },
+ {
+ agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ cursor: 'cursor',
+ limit: 1,
+ },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(ContextualAI.NotFoundError);
diff --git a/tests/api-resources/parse.test.ts b/tests/api-resources/parse.test.ts
index 1f71c69..bc5ad8e 100644
--- a/tests/api-resources/parse.test.ts
+++ b/tests/api-resources/parse.test.ts
@@ -103,7 +103,11 @@ describe('resource parse', () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.parse.jobs(
- { cursor: 'cursor', limit: 1, uploaded_after: '2019-12-27T18:11:19.117Z' },
+ {
+ cursor: 'cursor',
+ limit: 1,
+ uploaded_after: '2019-12-27T18:11:19.117Z',
+ },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(ContextualAI.NotFoundError);
diff --git a/tests/api-resources/rerank.test.ts b/tests/api-resources/rerank.test.ts
index 98c8b01..04611b0 100644
--- a/tests/api-resources/rerank.test.ts
+++ b/tests/api-resources/rerank.test.ts
@@ -10,7 +10,11 @@ const client = new ContextualAI({
describe('resource rerank', () => {
test('create: only required params', async () => {
- const responsePromise = client.rerank.create({ documents: ['string'], model: 'model', query: 'query' });
+ const responsePromise = client.rerank.create({
+ documents: ['string'],
+ model: 'model',
+ query: 'query',
+ });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
diff --git a/tests/api-resources/users.test.ts b/tests/api-resources/users.test.ts
index 2f335ce..db3fa87 100644
--- a/tests/api-resources/users.test.ts
+++ b/tests/api-resources/users.test.ts
@@ -26,7 +26,11 @@ describe('resource users', () => {
agent_level_roles: ['AGENT_LEVEL_USER'],
is_tenant_admin: true,
per_agent_roles: [
- { agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', grant: true, roles: ['AGENT_LEVEL_USER'] },
+ {
+ agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ grant: true,
+ roles: ['AGENT_LEVEL_USER'],
+ },
],
roles: ['VISITOR'],
});
@@ -54,7 +58,12 @@ describe('resource users', () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.users.list(
- { cursor: 'cursor', deactivated: true, limit: 0, search: 'search' },
+ {
+ cursor: 'cursor',
+ deactivated: true,
+ limit: 0,
+ search: 'search',
+ },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(ContextualAI.NotFoundError);
@@ -97,7 +106,11 @@ describe('resource users', () => {
agent_level_roles: ['AGENT_LEVEL_USER'],
is_tenant_admin: true,
per_agent_roles: [
- { agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', grant: true, roles: ['AGENT_LEVEL_USER'] },
+ {
+ agent_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ grant: true,
+ roles: ['AGENT_LEVEL_USER'],
+ },
],
roles: ['VISITOR'],
},
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 1c96dbd..bacab51 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -279,7 +279,11 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new ContextualAI({ apiKey: 'My API Key', timeout: 10, fetch: testFetch });
+ const client = new ContextualAI({
+ apiKey: 'My API Key',
+ timeout: 10,
+ fetch: testFetch,
+ });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
expect(count).toEqual(2);
@@ -309,7 +313,11 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new ContextualAI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+ const client = new ContextualAI({
+ apiKey: 'My API Key',
+ fetch: testFetch,
+ maxRetries: 4,
+ });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
@@ -333,7 +341,11 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new ContextualAI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+ const client = new ContextualAI({
+ apiKey: 'My API Key',
+ fetch: testFetch,
+ maxRetries: 4,
+ });
expect(
await client.request({
@@ -395,7 +407,11 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new ContextualAI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+ const client = new ContextualAI({
+ apiKey: 'My API Key',
+ fetch: testFetch,
+ maxRetries: 4,
+ });
expect(
await client.request({