import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
/**
* @param name The name of the index to be created. The maximum length is 45 characters.
*
* @param dimension The dimensions of the vectors to be inserted in the index.
*
* @param metric _(Optional)_ The distance metric to be used for similarity search.
*
* @param pods _(Optional)_ The number of pods for the index to use, including replicas.
*
* @param replicas _(Optional)_ The number of replicas.
*
* @param pod_type _(Optional)_ The pod type for the index.
* `s1`: Best storage capacity.
* `p1`: Faster queries.
* `p2`: Lowest latency and highest throughput.
*
* @param pod_size _(Optional)_ The size of the pod. You can increase (but not decrease) the pod size on running indexes.
* If `pod_type` is not set, this will be ignored.
*
* @param metadata_config _(Optional)_ Configuration for the behavior of Pinecone's internal metadata index.
* By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed.
*
* @param source_collection _(Optional)_ The name of the collection to create an index from.
*/
type Pinecone = {
apiKey: string;
environment: string;
};
export async function main(
auth: Pinecone,
name: string,
dimension: number,
metric?: "" | "euclidean" | "cosine" | "dotproduct",
pods?: number,
replicas?: number,
pod_type?: "" | "s1" | "p1" | "p2",
pod_size?: "" | "x1" | "x2" | "x4" | "x8",
metadata_config?: Record<string, string>,
source_collection?: number,
) {
const client = new PineconeClient();
await client.init(auth);
const createRequest = removeObjectEmptyFields({
name,
dimension,
metric,
pods,
replicas,
pod_type: pod_type ? `${pod_type}.${pod_size || "x1"}` : undefined,
metadata_config,
source_collection,
});
return await client.createIndex({ createRequest });
}
Submitted by admin 521 days ago
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
/**
* @param name The name of the index to be created. The maximum length is 45 characters.
*
* @param dimension The dimensions of the vectors to be inserted in the index.
*
* @param metric _(Optional)_ The distance metric to be used for similarity search.
*
* @param pods _(Optional)_ The number of pods for the index to use, including replicas.
*
* @param replicas _(Optional)_ The number of replicas.
*
* @param pod_type _(Optional)_ The pod type for the index.
* `s1`: Best storage capacity.
* `p1`: Faster queries.
* `p2`: Lowest latency and highest throughput.
*
* @param pod_size _(Optional)_ The size of the pod. You can increase (but not decrease) the pod size on running indexes.
* If `pod_type` is not set, this will be ignored.
*
* @param metadata_config _(Optional)_ Configuration for the behavior of Pinecone's internal metadata index.
* By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed.
*
* @param source_collection _(Optional)_ The name of the collection to create an index from.
*/
type Pinecone = {
apiKey: string;
environment: string;
};
export async function main(
auth: Pinecone,
name: string,
dimension: number,
metric?: '' | 'euclidean' | 'cosine' | 'dotproduct',
pods?: number,
replicas?: number,
pod_type?: '' | 's1' | 'p1' | 'p2',
pod_size?: '' | 'x1' | 'x2' | 'x4' | 'x8',
metadata_config?: Record<string, string>,
source_collection?: number,
) {
const client = new PineconeClient();
await client.init(auth);
const createRequest = removeObjectEmptyFields({
name,
dimension,
metric,
pods,
replicas,
pod_type: pod_type ? `${pod_type}.${pod_size || 'x1'}` : undefined,
metadata_config,
source_collection
})
return await client.createIndex({ createRequest });
}
Submitted by admin 524 days ago
import { Resource } from "https://deno.land/x/windmill@v1.88.1/mod.ts";
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
/**
* @param name The name of the index to be created. The maximum length is 45 characters.
*
* @param dimension The dimensions of the vectors to be inserted in the index.
*
* @param metric _(Optional)_ The distance metric to be used for similarity search.
*
* @param pods _(Optional)_ The number of pods for the index to use, including replicas.
*
* @param replicas _(Optional)_ The number of replicas.
*
* @param pod_type _(Optional)_ The pod type for the index.
* `s1`: Best storage capacity.
* `p1`: Faster queries.
* `p2`: Lowest latency and highest throughput.
*
* @param pod_size _(Optional)_ The size of the pod. You can increase (but not decrease) the pod size on running indexes.
* If `pod_type` is not set, this will be ignored.
*
* @param metadata_config _(Optional)_ Configuration for the behavior of Pinecone's internal metadata index.
* By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed.
*
* @param source_collection _(Optional)_ The name of the collection to create an index from.
*/
export async function main(
auth: Resource<"pinecone">,
name: string,
dimension: number,
metric?: '' | 'euclidean' | 'cosine' | 'dotproduct',
pods?: number,
replicas?: number,
pod_type?: '' | 's1' | 'p1' | 'p2',
pod_size?: '' | 'x1' | 'x2' | 'x4' | 'x8',
metadata_config?: Record<string, string>,
source_collection?: number,
) {
const client = new PineconeClient();
await client.init(auth);
const createRequest = removeObjectEmptyFields({
name,
dimension,
metric,
pods,
replicas,
pod_type: pod_type ? `${pod_type}.${pod_size || 'x1'}` : undefined,
metadata_config,
source_collection
})
return await client.createIndex({ createRequest });
}
Submitted by adam186 639 days ago