Edits history of script submission #340 for ' Query Index (pinecone)'

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { PineconeClient } from "npm:@pinecone-database/pinecone";
    import { QueryOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
    
    /**
     *
     * @param topK The number of results to return for each query.
     *
     * @param vector _(Conditionally Optional)_ The query vector. This should be the same length as the dimension
     * of the index being queried.
     * **Each query request can contain only one of the parameters "id" or "vector".**
     *
     * @param id _(Conditionally Optional)_ The unique ID of the vector to be used as a query vector.
     * **Each query request can contain only one of the parameters "vector" or "id".**
     *
     * @param namespace _(Optional)_ The namespace to query.
     *
     * @param includeValues _(Optional)_ Indicates whether vector values are included in the response.
     * Defaults to `false`.
     *
     * @param includeMetadata _(Optional)_ Indicates whether metadata is included in the response as well as the ids.
     * Defaults to `false`.
     *
     * @param filter _(Optional)_ The filter to apply. You can use vector metadata to limit your search.
     * See https://www.pinecone.io/docs/metadata-filtering/.
     */
    type Pinecone = {
      apiKey: string;
      environment: string;
    };
    export async function main(
      auth: Pinecone,
      index_name: string,
      topK: number,
      vector?: number[],
      id?: string,
      namespace?: string,
      include_values?: boolean,
      include_metadata?: boolean,
      filter?: object,
      raw?: boolean,
    ) {
      const client = new PineconeClient();
      await client.init(auth);
      const index = client.Index(index_name);
    
      const queryRequest: QueryOperationRequest = removeObjectEmptyFields({
        topK,
        vector,
        id,
        namespace,
        includeValues: include_values,
        includeMetadata: include_metadata,
        filter,
      });
      return await index[raw ? "queryRaw" : "query"]({ queryRequest });
    }
    

    Submitted by hugo697 399 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { PineconeClient } from "npm:@pinecone-database/pinecone";
    import { QueryOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
    
    /**
     *
     * @param topK The number of results to return for each query.
     *
     * @param vector _(Conditionally Optional)_ The query vector. This should be the same length as the dimension
     * of the index being queried.
     * **Each query request can contain only one of the parameters "id" or "vector".**
     *
     * @param id _(Conditionally Optional)_ The unique ID of the vector to be used as a query vector.
     * **Each query request can contain only one of the parameters "vector" or "id".**
     *
     * @param namespace _(Optional)_ The namespace to query.
     *
     * @param includeValues _(Optional)_ Indicates whether vector values are included in the response.
     * Defaults to `false`.
     *
     * @param includeMetadata _(Optional)_ Indicates whether metadata is included in the response as well as the ids.
     * Defaults to `false`.
     *
     * @param filter _(Optional)_ The filter to apply. You can use vector metadata to limit your search.
     * See https://www.pinecone.io/docs/metadata-filtering/.
     */
    type Pinecone = {
      apiKey: string;
      environment: string;
    };
    export async function main(
      auth: Pinecone,
      index_name: string,
      topK: number,
      vector?: number[],
      id?: string,
      namespace?: string,
      include_values?: boolean,
      include_metadata?: boolean,
      filter?: object,
      raw?: boolean,
    ) {
      const client = new PineconeClient();
      await client.init(auth);
      const index = client.Index(index_name);
    
      const queryRequest: QueryOperationRequest = removeObjectEmptyFields({
        topK,
        vector,
        id,
        namespace,
        includeValues: include_values,
        includeMetadata: include_metadata,
        filter,
      });
      return await index[raw ? "queryRaw" : "query"]({ queryRequest });
    }
    

    Submitted by admin 1031 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { PineconeClient } from "npm:@pinecone-database/pinecone";
    import { QueryOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
    
    /**
     * 
     * @param topK The number of results to return for each query.
     * 
     * @param vector _(Conditionally Optional)_ The query vector. This should be the same length as the dimension
     * of the index being queried.
     * **Each query request can contain only one of the parameters "id" or "vector".**
     * 
     * @param id _(Conditionally Optional)_ The unique ID of the vector to be used as a query vector.
     * **Each query request can contain only one of the parameters "vector" or "id".**
     * 
     * @param namespace _(Optional)_ The namespace to query.
     * 
     * @param includeValues _(Optional)_ Indicates whether vector values are included in the response.
     * Defaults to `false`.
     * 
     * @param includeMetadata _(Optional)_ Indicates whether metadata is included in the response as well as the ids.
     * Defaults to `false`.
     * 
     * @param filter _(Optional)_ The filter to apply. You can use vector metadata to limit your search.
     * See https://www.pinecone.io/docs/metadata-filtering/.
     */
    type Pinecone = {
      apiKey: string;
      environment: string;
    };
    export async function main(
      auth: Pinecone,
      index_name: string,
      topK: number,
      vector?: number[],
      id?: string,
      namespace?: string,
      include_values?: boolean,
      include_metadata?: boolean,
      filter?: object,
      raw?: boolean,
    ) {
      const client = new PineconeClient();
      await client.init(auth);
      const index = client.Index(index_name);
    
      const queryRequest: QueryOperationRequest = removeObjectEmptyFields({
        topK,
        vector,
        id,
        namespace,
        includeValues: include_values,
        includeMetadata: include_metadata,
        filter
      });
      return await index[raw ? "queryRaw" : "query"]({ queryRequest });
    }
    

    Submitted by admin 1034 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { PineconeClient } from "npm:@pinecone-database/pinecone";
    import { QueryOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
    
    /**
     * 
     * @param topK The number of results to return for each query.
     * 
     * @param vector _(Conditionally Optional)_ The query vector. This should be the same length as the dimension
     * of the index being queried.
     * **Each query request can contain only one of the parameters "id" or "vector".**
     * 
     * @param id _(Conditionally Optional)_ The unique ID of the vector to be used as a query vector.
     * **Each query request can contain only one of the parameters "vector" or "id".**
     * 
     * @param namespace _(Optional)_ The namespace to query.
     * 
     * @param includeValues _(Optional)_ Indicates whether vector values are included in the response.
     * Defaults to `false`.
     * 
     * @param includeMetadata _(Optional)_ Indicates whether metadata is included in the response as well as the ids.
     * Defaults to `false`.
     * 
     * @param filter _(Optional)_ The filter to apply. You can use vector metadata to limit your search.
     * See https://www.pinecone.io/docs/metadata-filtering/.
     */
    export async function main(
      auth: Resource<"pinecone">,
      index_name: string,
      topK: number,
      vector?: number[],
      id?: string,
      namespace?: string,
      include_values?: boolean,
      include_metadata?: boolean,
      filter?: object,
      raw?: boolean,
    ) {
      const client = new PineconeClient();
      await client.init(auth);
      const index = client.Index(index_name);
    
      const queryRequest: QueryOperationRequest = removeObjectEmptyFields({
        topK,
        vector,
        id,
        namespace,
        includeValues: include_values,
        includeMetadata: include_metadata,
        filter
      });
      return await index[raw ? "queryRaw" : "query"]({ queryRequest });
    }
    

    Submitted by adam186 1149 days ago