import { Configuration, OpenAIApi } from "npm:openai@3.1.0";
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 486 days ago
import { Configuration, OpenAIApi } from "npm:openai@3.1.0"
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 490 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import { Configuration, OpenAIApi } from "npm:openai@3.1.0"
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 618 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import { Configuration, OpenAIApi } from "npm:openai@3.1.0"
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 653 days ago
import type { Resource } from "https://deno.land/x/windmill@v1.55.0/mod.ts";
import { Configuration, OpenAIApi } from "npm:openai@3.1.0"
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 727 days ago