Add smoketest (broken)
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import "dotenv/config";
|
||||
import { Configuration, OpenPipeApi } from "../index";
|
||||
import { Configuration, OpenAIApi } from 'openai'
|
||||
import { Configuration as OPConfiguration, OpenPipeApi } from "..";
|
||||
|
||||
const config = new Configuration({
|
||||
|
||||
export const openAIConfig = new Configuration({ apiKey: process.env.OPENAI_API_KEY });
|
||||
|
||||
const openai = new OpenAIApi(openAIConfig);
|
||||
|
||||
const config = new OPConfiguration({
|
||||
opOptions: {
|
||||
apiKey: "mock-key",
|
||||
basePath: "http://localhost:3000/api",
|
||||
@@ -11,7 +17,7 @@ const config = new Configuration({
|
||||
const client = new OpenPipeApi(config);
|
||||
|
||||
async function main() {
|
||||
const prompt = client.capturePrompt(
|
||||
const prompt = await client.capturePrompt(
|
||||
"123",
|
||||
"openai/ChatCompletion",
|
||||
() => ({
|
||||
@@ -26,17 +32,9 @@ async function main() {
|
||||
{}
|
||||
);
|
||||
|
||||
const response = await client.createChatCompletion({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: "count to 3 in french",
|
||||
},
|
||||
],
|
||||
});
|
||||
const response = await openai.createChatCompletion(prompt.prompt);
|
||||
|
||||
console.log("got response", response.data);
|
||||
console.log("got response", response.data.choices[0].message);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
|
||||
Reference in New Issue
Block a user