Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prompts to prompt #1236

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions langchain/src/client/langchainplus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ export class LangChainPlusClient {
const results: (LLMResult | string)[] = await Promise.all(
Array.from({ length: numRepetitions }).map(async () => {
try {
const prompts = example.inputs.prompts as string[];
return llm.generate(prompts, undefined, [tracer]);
const prompt = example.inputs.prompt as string;
return llm.generate([prompt], undefined, [tracer]);
} catch (e) {
console.error(e);
return stringifyError(e);
Expand Down
41 changes: 33 additions & 8 deletions langchain/src/client/tests/langchainplus.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ChatOpenAI } from "../../chat_models/openai.js";
import { SerpAPI } from "../../tools/serpapi.js";
import { Calculator } from "../../tools/calculator.js";
import { initializeAgentExecutorWithOptions } from "../../agents/initialize.js";
import { OpenAI } from "../../llms/openai.js";

test("Test LangChainPlus Client Dataset CRD", async () => {
const client: LangChainPlusClient = await LangChainPlusClient.create(
Expand Down Expand Up @@ -64,7 +65,7 @@ test("Test LangChainPlus Client Run Chat Model Over Simple Dataset", async () =>
const client: LangChainPlusClient = await LangChainPlusClient.create(
"http://localhost:8000"
);
const datasetName = "chat-test.json";
const datasetName = "chat-test";
const description = "Asking a chat model test things";
// Check if dataset name exists in listDatasets
const datasets = await client.listDatasets();
Expand Down Expand Up @@ -96,6 +97,36 @@ test("Test LangChainPlus Client Run Chat Model Over Simple Dataset", async () =>
expect(Object.keys(results).length).toEqual(1);
});

test("Test LangChainPlus Client Run LLM Over Simple Dataset", async () => {
const client: LangChainPlusClient = await LangChainPlusClient.create(
"http://localhost:8000"
);
const datasetName = "llm-test";
const description = "Asking a chat model test things";
// Check if dataset name exists in listDatasets
const datasets = await client.listDatasets();
if (!datasets.map((d) => d.name).includes(datasetName)) {
const newDataset = await client.createDataset(datasetName, description);
await client.createExample(
{
prompt: "Write LangChain backwards:",
},
{
generations: [
{
text: "niarhCgnaL",
},
],
},
newDataset.id
);
}
const model = new OpenAI({ temperature: 0 });
const results = await client.runOnDataset(datasetName, model);
console.log(results);
expect(Object.keys(results).length).toEqual(1);
});

test("Test LangChainPlus Client Run Chain Over Simple Dataset", async () => {
const client: LangChainPlusClient = await LangChainPlusClient.create(
"http://localhost:8000"
Expand Down Expand Up @@ -144,14 +175,8 @@ test("Test LangChainPlus Client Run Chain Over Dataset", async () => {
input,output
How many people live in canada as of 2023?,"approximately 38,625,801"
who is dua lipa's boyfriend? what is his age raised to the .43 power?,her boyfriend is Romain Gravas. his age raised to the .43 power is approximately 4.9373857399466665
what is dua lipa's boyfriend age raised to the .43 power?,her boyfriend is Romain Gravas. his age raised to the .43 power is approximately 4.9373857399466665
how far is it from paris to boston in miles,"approximately 3,435 mi"
what was the total number of points scored in the 2023 super bowl? what is that number raised to the .23 power?,approximately 2.682651500990882
what was the total number of points scored in the 2023 super bowl raised to the .23 power?,approximately 2.682651500990882
how many more points were scored in the 2023 super bowl than in the 2022 super bowl?,30
what is 153 raised to .1312 power?,approximately 1.9347796717823205
who is kendall jenner's boyfriend? what is his height (in inches) raised to .13 power?,approximately 1.7589107138176394
what is 1213 divided by 4345?,approximately 0.2791714614499425
what was the tjtal number of points scored in the 2023 super bowl? what is that number raised to the .23 power?,approximately 2.682651500990882
`;
const blobData = new Blob([Buffer.from(csvContent)]);

Expand Down