Skip to content

Regenerate core, expose privateHost and temperature #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/apis
Submodule apis updated from a91585 to 827d26
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing local runner since the script was moved previously.

"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/"
Expand Down
7 changes: 5 additions & 2 deletions src/assistant/data/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving away from hard-coding this.

.map((m) => `"${m}"`)
.join(', ')}:`
);
} else {
model = options.model as ChatModelEnum;
Expand Down
6 changes: 1 addition & 5 deletions src/assistant/data/chatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
13 changes: 13 additions & 0 deletions src/assistant/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -160,6 +166,7 @@ type ChatOptionsType = keyof ChatOptions;
export const ChatOptionsType: ChatOptionsType[] = [
'messages',
'model',
'temperature',
'filter',
'jsonResponse',
'includeHighlights',
Expand All @@ -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.
*/
Expand All @@ -192,6 +204,7 @@ type ChatCompletionOptionsType = keyof ChatCompletionOptions;
export const ChatCompletionOptionsType: ChatCompletionOptionsType[] = [
'messages',
'model',
'temperature',
'filter',
];

Expand Down
2 changes: 1 addition & 1 deletion src/integration/assistant-data/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
);
});

Expand Down
6 changes: 4 additions & 2 deletions src/integration/data/vectors/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ describe('query tests on serverless index', () => {
if (results.usage) {
expect(results.usage.readUnits).toBeDefined();
}
}
},
240000
);
});

Expand All @@ -110,7 +111,8 @@ describe('query tests on serverless index', () => {
if (results.usage) {
expect(results.usage.readUnits).toBeDefined();
}
}
},
240000
);
});
});
14 changes: 13 additions & 1 deletion src/pinecone-generated-ts-fetch/assistant_data/models/Chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -110,6 +120,7 @@ export function ChatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Chat
'messages': ((json['messages'] as Array<any>).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'],
Expand All @@ -129,6 +140,7 @@ export function ChatToJSON(value?: Chat | null): any {
'messages': ((value.messages as Array<any>).map(MessageModelToJSON)),
'stream': value.stream,
'model': value.model,
'temperature': value.temperature,
'filter': value.filter,
'json_response': value.jsonResponse,
'include_highlights': value.includeHighlights,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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];

Expand Down Expand Up @@ -86,6 +96,7 @@ export function SearchCompletionsFromJSONTyped(json: any, ignoreDiscriminator: b
'messages': ((json['messages'] as Array<any>).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'],
};
}
Expand All @@ -102,6 +113,7 @@ export function SearchCompletionsToJSON(value?: SearchCompletions | null): any {
'messages': ((value.messages as Array<any>).map(MessageModelToJSON)),
'stream': value.stream,
'model': value.model,
'temperature': value.temperature,
'filter': value.filter,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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']),
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<runtime.ApiResponse<QueryResponse>> {
Expand Down Expand Up @@ -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<QueryResponse> {
Expand All @@ -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<runtime.ApiResponse<SearchRecordsResponse>> {
Expand Down Expand Up @@ -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<SearchRecordsResponse> {
Expand Down Expand Up @@ -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<runtime.ApiResponse<void>> {
Expand Down Expand Up @@ -434,15 +434,15 @@ 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<void> {
await this.upsertRecordsNamespaceRaw(requestParameters, initOverrides);
}

/**
* 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<runtime.ApiResponse<UpsertResponse>> {
Expand Down Expand Up @@ -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<UpsertResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector>}
* @memberof UpsertRequest
*/
Expand Down