Edits history of script submission #248 for ' Create embedding (openai)'

  • deno
    import { Configuration, OpenAIApi } from "npm:[email protected]";
    
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      model: string = "text-embedding-ada-002",
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id,
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createEmbedding({
        model,
        input: prompt,
      });
      return response.data.data;
    }
    

    Submitted by admin 1009 days ago

  • deno
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      model: string = 'text-embedding-ada-002',
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createEmbedding({
        model,
        input: prompt
      });
      return response.data.data;
    }
    

    Submitted by admin 1012 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      model: string = 'text-embedding-ada-002',
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createEmbedding({
        model,
        input: prompt
      });
      return response.data.data;
    }
    

    Submitted by adam186 1140 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      model: string = 'text-embedding-ada-002',
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createEmbedding({
        model,
        input: prompt
      });
      return response.data.data;
    }
    

    Submitted by adam186 1175 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      model: string = 'text-embedding-ada-002',
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createEmbedding({
        model,
        input: prompt
      });
      return response.data.data;
    }
    

    Submitted by adam186 1249 days ago