From 8162d9534c2385ae741a15bd415bc84c838240db Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Sat, 14 Jun 2025 12:15:18 -0400 Subject: [PATCH 1/4] regenerate 2025-04, expose privateHost, add temperature to both ChatOptions and ChatCompletionOptions, update models enums for assistant --- codegen/apis | 2 +- src/assistant/data/types.ts | 13 +++++++++++++ .../assistant_data/models/Chat.ts | 14 +++++++++++++- .../assistant_data/models/SearchCompletions.ts | 14 +++++++++++++- .../db_control/models/IndexModel.ts | 8 ++++++++ .../db_data/apis/VectorOperationsApi.ts | 16 ++++++++-------- .../db_data/models/DeleteRequest.ts | 3 +-- .../db_data/models/UpsertRequest.ts | 2 +- 8 files changed, 58 insertions(+), 14 deletions(-) diff --git a/codegen/apis b/codegen/apis index a9158581..827d26f4 160000 --- a/codegen/apis +++ b/codegen/apis @@ -1 +1 @@ -Subproject commit a91585819b21bcd355fd76dab94546bb7908a008 +Subproject commit 827d26f4825902994a099595d49779d16fea3a0a diff --git a/src/assistant/data/types.ts b/src/assistant/data/types.ts index f3c49be1..8f0ded87 100644 --- a/src/assistant/data/types.ts +++ b/src/assistant/data/types.ts @@ -131,6 +131,12 @@ export interface ChatOptions { * If empty, the assistant will default to using 'gpt-4o' model. */ model?: string; + /** + * Controls the randomness of the model's output: lower values make responses more deterministic, + * while higher values increase creativity and variability. If the model does not support a temperature parameter, the parameter will be ignored. + */ + temperature?: number; + /** * A filter against which documents can be retrieved. */ @@ -160,6 +166,7 @@ type ChatOptionsType = keyof ChatOptions; export const ChatOptionsType: ChatOptionsType[] = [ 'messages', 'model', + 'temperature', 'filter', 'jsonResponse', 'includeHighlights', @@ -181,6 +188,11 @@ export interface ChatCompletionOptions { * If empty, the assistant will default to using 'gpt-4o' model. */ model?: string; + /** + * Controls the randomness of the model's output: lower values make responses more deterministic, + * while higher values increase creativity and variability. If the model does not support a temperature parameter, the parameter will be ignored. + */ + temperature?: number; /** * A filter against which documents can be retrieved. */ @@ -192,6 +204,7 @@ type ChatCompletionOptionsType = keyof ChatCompletionOptions; export const ChatCompletionOptionsType: ChatCompletionOptionsType[] = [ 'messages', 'model', + 'temperature', 'filter', ]; diff --git a/src/pinecone-generated-ts-fetch/assistant_data/models/Chat.ts b/src/pinecone-generated-ts-fetch/assistant_data/models/Chat.ts index 617728d1..a71f5aa8 100644 --- a/src/pinecone-generated-ts-fetch/assistant_data/models/Chat.ts +++ b/src/pinecone-generated-ts-fetch/assistant_data/models/Chat.ts @@ -50,6 +50,12 @@ export interface Chat { * @memberof Chat */ model?: ChatModelEnum; + /** + * Controls the randomness of the model's output: lower values make responses more deterministic, while higher values increase creativity and variability. If the model does not support a temperature parameter, the parameter will be ignored. + * @type {number} + * @memberof Chat + */ + temperature?: number; /** * Optionally filter which documents can be retrieved using the following metadata fields. * @type {object} @@ -82,7 +88,11 @@ export interface Chat { */ export const ChatModelEnum = { Gpt4o: 'gpt-4o', - Claude35Sonnet: 'claude-3-5-sonnet' + Gpt41: 'gpt-4.1', + O4Mini: 'o4-mini', + Claude35Sonnet: 'claude-3-5-sonnet', + Claude37Sonnet: 'claude-3-7-sonnet', + Gemini25Pro: 'gemini-2.5-pro' } as const; export type ChatModelEnum = typeof ChatModelEnum[keyof typeof ChatModelEnum]; @@ -110,6 +120,7 @@ export function ChatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Chat 'messages': ((json['messages'] as Array).map(MessageModelFromJSON)), 'stream': !exists(json, 'stream') ? undefined : json['stream'], 'model': !exists(json, 'model') ? undefined : json['model'], + 'temperature': !exists(json, 'temperature') ? undefined : json['temperature'], 'filter': !exists(json, 'filter') ? undefined : json['filter'], 'jsonResponse': !exists(json, 'json_response') ? undefined : json['json_response'], 'includeHighlights': !exists(json, 'include_highlights') ? undefined : json['include_highlights'], @@ -129,6 +140,7 @@ export function ChatToJSON(value?: Chat | null): any { 'messages': ((value.messages as Array).map(MessageModelToJSON)), 'stream': value.stream, 'model': value.model, + 'temperature': value.temperature, 'filter': value.filter, 'json_response': value.jsonResponse, 'include_highlights': value.includeHighlights, diff --git a/src/pinecone-generated-ts-fetch/assistant_data/models/SearchCompletions.ts b/src/pinecone-generated-ts-fetch/assistant_data/models/SearchCompletions.ts index 88c057f8..59027e98 100644 --- a/src/pinecone-generated-ts-fetch/assistant_data/models/SearchCompletions.ts +++ b/src/pinecone-generated-ts-fetch/assistant_data/models/SearchCompletions.ts @@ -44,6 +44,12 @@ export interface SearchCompletions { * @memberof SearchCompletions */ model?: SearchCompletionsModelEnum; + /** + * Controls the randomness of the model's output: lower values make responses more deterministic, while higher values increase creativity and variability. If the model does not support a temperature parameter, the parameter will be ignored. + * @type {number} + * @memberof SearchCompletions + */ + temperature?: number; /** * Optionally filter which documents can be retrieved using the following metadata fields. * @type {object} @@ -58,7 +64,11 @@ export interface SearchCompletions { */ export const SearchCompletionsModelEnum = { Gpt4o: 'gpt-4o', - Claude35Sonnet: 'claude-3-5-sonnet' + Gpt41: 'gpt-4.1', + O4Mini: 'o4-mini', + Claude35Sonnet: 'claude-3-5-sonnet', + Claude37Sonnet: 'claude-3-7-sonnet', + Gemini25Pro: 'gemini-2.5-pro' } as const; export type SearchCompletionsModelEnum = typeof SearchCompletionsModelEnum[keyof typeof SearchCompletionsModelEnum]; @@ -86,6 +96,7 @@ export function SearchCompletionsFromJSONTyped(json: any, ignoreDiscriminator: b 'messages': ((json['messages'] as Array).map(MessageModelFromJSON)), 'stream': !exists(json, 'stream') ? undefined : json['stream'], 'model': !exists(json, 'model') ? undefined : json['model'], + 'temperature': !exists(json, 'temperature') ? undefined : json['temperature'], 'filter': !exists(json, 'filter') ? undefined : json['filter'], }; } @@ -102,6 +113,7 @@ export function SearchCompletionsToJSON(value?: SearchCompletions | null): any { 'messages': ((value.messages as Array).map(MessageModelToJSON)), 'stream': value.stream, 'model': value.model, + 'temperature': value.temperature, 'filter': value.filter, }; } diff --git a/src/pinecone-generated-ts-fetch/db_control/models/IndexModel.ts b/src/pinecone-generated-ts-fetch/db_control/models/IndexModel.ts index 1b6b7fba..47072958 100644 --- a/src/pinecone-generated-ts-fetch/db_control/models/IndexModel.ts +++ b/src/pinecone-generated-ts-fetch/db_control/models/IndexModel.ts @@ -68,6 +68,12 @@ export interface IndexModel { * @memberof IndexModel */ host: string; + /** + * The private endpoint URL of an index. + * @type {string} + * @memberof IndexModel + */ + privateHost?: string; /** * * @type {DeletionProtection} @@ -147,6 +153,7 @@ export function IndexModelFromJSONTyped(json: any, ignoreDiscriminator: boolean) 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], 'metric': json['metric'], 'host': json['host'], + 'privateHost': !exists(json, 'private_host') ? undefined : json['private_host'], 'deletionProtection': !exists(json, 'deletion_protection') ? undefined : DeletionProtectionFromJSON(json['deletion_protection']), 'tags': !exists(json, 'tags') ? undefined : json['tags'], 'embed': !exists(json, 'embed') ? undefined : ModelIndexEmbedFromJSON(json['embed']), @@ -169,6 +176,7 @@ export function IndexModelToJSON(value?: IndexModel | null): any { 'dimension': value.dimension, 'metric': value.metric, 'host': value.host, + 'private_host': value.privateHost, 'deletion_protection': DeletionProtectionToJSON(value.deletionProtection), 'tags': value.tags, 'embed': ModelIndexEmbedToJSON(value.embed), diff --git a/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts b/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts index 5cdedd6b..872f3e6f 100644 --- a/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts +++ b/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts @@ -279,7 +279,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Search a namespace using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Search](https://docs.pinecone.io/guides/search/semantic-search). + * Search a namespace using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). * Search with a vector */ async queryVectorsRaw(requestParameters: QueryVectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -309,7 +309,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Search a namespace using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Search](https://docs.pinecone.io/guides/search/semantic-search). + * Search a namespace using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). * Search with a vector */ async queryVectors(requestParameters: QueryVectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -318,7 +318,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Search a namespace with a query text, query vector, or record ID and return the most similar records, along with their similarity scores. Optionally, rerank the initial results based on their relevance to the query. Searching with text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/guides/indexes/create-an-index#integrated-embedding). Searching with a query vector or record ID is supported for all indexes. For guidance and examples, see [Search](https://docs.pinecone.io/guides/search/semantic-search). + * Search a namespace with a query text, query vector, or record ID and return the most similar records, along with their similarity scores. Optionally, rerank the initial results based on their relevance to the query. Searching with text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/guides/indexes/create-an-index#integrated-embedding). Searching with a query vector or record ID is supported for all indexes. For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). * Search with text */ async searchRecordsNamespaceRaw(requestParameters: SearchRecordsNamespaceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -352,7 +352,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Search a namespace with a query text, query vector, or record ID and return the most similar records, along with their similarity scores. Optionally, rerank the initial results based on their relevance to the query. Searching with text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/guides/indexes/create-an-index#integrated-embedding). Searching with a query vector or record ID is supported for all indexes. For guidance and examples, see [Search](https://docs.pinecone.io/guides/search/semantic-search). + * Search a namespace with a query text, query vector, or record ID and return the most similar records, along with their similarity scores. Optionally, rerank the initial results based on their relevance to the query. Searching with text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/guides/indexes/create-an-index#integrated-embedding). Searching with a query vector or record ID is supported for all indexes. For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). * Search with text */ async searchRecordsNamespace(requestParameters: SearchRecordsNamespaceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -400,7 +400,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Upsert text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index. Upserting text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/reference/api/2025-01/control-plane/create_for_model). For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data#upsert-text). + * Upsert text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index. Upserting text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/reference/api/2025-01/control-plane/create_for_model). For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). * Upsert text */ async upsertRecordsNamespaceRaw(requestParameters: UpsertRecordsNamespaceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -434,7 +434,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Upsert text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index. Upserting text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/reference/api/2025-01/control-plane/create_for_model). For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data#upsert-text). + * Upsert text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index. Upserting text is supported only for [indexes with integrated embedding](https://docs.pinecone.io/reference/api/2025-01/control-plane/create_for_model). For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). * Upsert text */ async upsertRecordsNamespace(requestParameters: UpsertRecordsNamespaceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -442,7 +442,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Upsert vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data#upsert-vectors). + * Upsert vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). * Upsert vectors */ async upsertVectorsRaw(requestParameters: UpsertVectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -472,7 +472,7 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * Upsert vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data#upsert-vectors). + * Upsert vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). * Upsert vectors */ async upsertVectors(requestParameters: UpsertVectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { diff --git a/src/pinecone-generated-ts-fetch/db_data/models/DeleteRequest.ts b/src/pinecone-generated-ts-fetch/db_data/models/DeleteRequest.ts index f10f45ec..10058abe 100644 --- a/src/pinecone-generated-ts-fetch/db_data/models/DeleteRequest.ts +++ b/src/pinecone-generated-ts-fetch/db_data/models/DeleteRequest.ts @@ -38,8 +38,7 @@ export interface DeleteRequest { */ namespace?: string; /** - * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Understanding metadata](https://docs.pinecone.io/guides/index-data/indexing-overview#metadata). - * Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID. + * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Delete data](https://docs.pinecone.io/guides/manage-data/delete-data#delete-records-by-metadata). * @type {object} * @memberof DeleteRequest */ diff --git a/src/pinecone-generated-ts-fetch/db_data/models/UpsertRequest.ts b/src/pinecone-generated-ts-fetch/db_data/models/UpsertRequest.ts index 9555e8e4..9dbfcae8 100644 --- a/src/pinecone-generated-ts-fetch/db_data/models/UpsertRequest.ts +++ b/src/pinecone-generated-ts-fetch/db_data/models/UpsertRequest.ts @@ -27,7 +27,7 @@ import { */ export interface UpsertRequest { /** - * An array containing the vectors to upsert. Recommended batch limit is 100 vectors. + * An array containing the vectors to upsert. Recommended batch limit is up to 1000 vectors. * @type {Array} * @memberof UpsertRequest */ From a1a8b6f2be58f25663083cb4956ef57c953b71d1 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Sat, 14 Jun 2025 13:04:32 -0400 Subject: [PATCH 2/4] update chat validations to use the actual enum values in thrown errors, update test --- package.json | 4 ++-- src/assistant/data/chat.ts | 7 +++++-- src/integration/assistant-data/chat.test.ts | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 17f0edfd..13c8cacc 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "lint": "eslint src/ --ext .ts", "repl": "npm run build && node utils/replInit.ts", "test:integration:node": "TEST_ENV=node jest src/integration/ -c jest.config.integration-node.js --detectOpenHandles --runInBand --bail --forceExit", - "test:integration-local:node": "TEST_ENV=node node src/integration/integrationRunner.js", + "test:integration-local:node": "TEST_ENV=node node utils/integrationRunner.js", "test:integration:edge": "TEST_ENV=edge jest src/integration/ -c jest.config.integration-edge.js --detectOpenHandles --runInBand --bail --forceExit", - "test:integration-local:edge": "TEST_ENV=edge node src/integration/integrationRunner.js", + "test:integration-local:edge": "TEST_ENV=edge node utils/integrationRunner.js", "test:integration:cleanup": "npm run build && node utils/cleanupResources.ts", "test:external-app-local": "chmod +x ts-external-app-test/local-external-app.sh && ts-external-app-test/local-external-app.sh", "test:unit": "jest src/" diff --git a/src/assistant/data/chat.ts b/src/assistant/data/chat.ts index 980d8b01..0f41687f 100644 --- a/src/assistant/data/chat.ts +++ b/src/assistant/data/chat.ts @@ -130,12 +130,15 @@ export const messagesValidation = (options: ChatOptions): MessageModel[] => { * @throws An Error if the model is not one of the available models as outlined in {@link ChatModelEnum}. */ export const modelValidation = (options: ChatOptions) => { + const allowedModels = Object.values(ChatModelEnum); // Make sure passed string for 'model' matches one of the Enum values; default to Gpt4o let model: ChatModelEnum = ChatModelEnum.Gpt4o; if (options.model) { - if (!Object.values(ChatModelEnum).toString().includes(options.model)) { + if (!allowedModels.includes(options.model as ChatModelEnum)) { throw new Error( - 'Invalid model specified. Must be one of "gpt-4o" or "claude-3-5-sonnet"' + `Invalid model specified. Must be one of ${allowedModels + .map((m) => `"${m}"`) + .join(', ')}:` ); } else { model = options.model as ChatModelEnum; diff --git a/src/integration/assistant-data/chat.test.ts b/src/integration/assistant-data/chat.test.ts index d3716779..a3e64bfe 100644 --- a/src/integration/assistant-data/chat.test.ts +++ b/src/integration/assistant-data/chat.test.ts @@ -203,7 +203,7 @@ describe('Chat error paths', () => { model: 'invalid', }) ).rejects.toThrow( - 'Invalid model: "invalid". Must be one of: "gpt-4o", "claude-3-5-sonnet"' + 'Invalid model: "invalid". Must be one of: "gpt-4o", "gpt-4.1", "o4-mini", "claude-3-5-sonnet", "claude-3-7-sonnet", "gemini-2.5-pro"' ); }); From caeaf6362c8e9a7ab4a305ca6b7981e3b19ad5ca Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Sat, 14 Jun 2025 13:24:55 -0400 Subject: [PATCH 3/4] remove unused import --- src/assistant/data/chatStream.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/assistant/data/chatStream.ts b/src/assistant/data/chatStream.ts index daef3d1e..926aaeaa 100644 --- a/src/assistant/data/chatStream.ts +++ b/src/assistant/data/chatStream.ts @@ -5,11 +5,7 @@ import { import type { PineconeConfiguration } from '../../data'; import { buildUserAgent, getFetch, ChatStream } from '../../utils'; import { AsstDataOperationsProvider } from './asstDataOperationsProvider'; -import type { - ChatOptions, - ContextOptions, - StreamedChatResponse, -} from './types'; +import type { ChatOptions, StreamedChatResponse } from './types'; import { handleApiError } from '../../errors'; import { ReadableStream } from 'node:stream/web'; import { Readable } from 'node:stream'; From ec768fb192192aeedb34ccff6b16676ce77f6b81 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Sat, 14 Jun 2025 14:25:53 -0400 Subject: [PATCH 4/4] add more retry time to serverless query tests to account for possible freshness issues --- src/integration/data/vectors/query.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/integration/data/vectors/query.test.ts b/src/integration/data/vectors/query.test.ts index 43e5f06c..2ea69f78 100644 --- a/src/integration/data/vectors/query.test.ts +++ b/src/integration/data/vectors/query.test.ts @@ -88,7 +88,8 @@ describe('query tests on serverless index', () => { if (results.usage) { expect(results.usage.readUnits).toBeDefined(); } - } + }, + 240000 ); }); @@ -110,7 +111,8 @@ describe('query tests on serverless index', () => { if (results.usage) { expect(results.usage.readUnits).toBeDefined(); } - } + }, + 240000 ); }); });