Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jul 25, 2024
1 parent 7e1aefc commit 62703fa
Show file tree
Hide file tree
Showing 117 changed files with 1,109 additions and 456 deletions.
40 changes: 20 additions & 20 deletions langchain/src/agents/tests/agent.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ test("Pass runnable to agent executor", async () => {
"Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
});
// console.log(
{
res,
},
"Pass runnable to agent executor"
);
// {
// res,
// },
// "Pass runnable to agent executor"
// );
expect(res.output).not.toEqual("");
expect(res.output).not.toEqual("Agent stopped due to max iterations.");
});
Expand Down Expand Up @@ -116,11 +116,11 @@ test("Custom output parser", async () => {
"Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
});
// console.log(
{
res,
},
"Custom output parser"
);
// {
// res,
// },
// "Custom output parser"
// );
expect(res.output).toEqual("We did it!");
});

Expand Down Expand Up @@ -161,11 +161,11 @@ test("Add a fallback method", async () => {
input: "Is the sky blue? Response with a concise answer",
});
// console.log(
{
res,
},
"Pass runnable to agent executor"
);
// {
// res,
// },
// "Pass runnable to agent executor"
// );
expect(res.output).not.toEqual("");
expect(res.output).not.toEqual("Agent stopped due to max iterations.");
});
Expand Down Expand Up @@ -253,11 +253,11 @@ test("Run tool web-browser", async () => {

const result = await executor.call({ input });
// console.log(
{
result,
},
"Run tool web-browser"
);
// {
// result,
// },
// "Run tool web-browser"
// );
expect(result.intermediateSteps.length).toBeGreaterThanOrEqual(1);
expect(result.intermediateSteps[0].action.tool).toEqual("search");
expect(result.intermediateSteps[1].action.tool).toEqual("web-browser");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ test("createOpenAIFunctionsAgent can stream log", async () => {
// console.log(chunks.length);
// console.log();
// console.log(
"Time to complete after first chunk:",
new Date().getTime() - firstChunkTime
);
// "Time to complete after first chunk:",
// new Date().getTime() - firstChunkTime
// );

// console.log(chunks.length);
expect(chunks.length).toBeGreaterThan(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ test.skip("createOpenAIToolsAgent tracing works when it is nested in a lambda",
const noop = RunnableLambda.from(() => "hi").withConfig({
runName: "nested_testing",
});
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const noopRes = await noop.invoke({ nested: "nested" });
// console.log(noopRes);
const res = await agentExecutor.invoke({
Expand Down
2 changes: 2 additions & 0 deletions langchain/src/agents/tests/runnable.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ test("Runnable variant", async () => {

const query = "What is the weather in New York?";
// console.log(`Calling agent executor with query: ${query}`);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await executor.invoke({
input: query,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ test("Pass custom structured output parsers", async () => {
tools: [retrieverTool],
});
/** Call invoke on the agent */
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await executor.invoke({
input: "what did the president say about kentaji brown jackson",
});
// console.log({
res,
});
// res,
// });
/**
{
res: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,26 @@ test("Test ConversationalRetrievalAgent", async () => {
const executor = await createConversationalRetrievalAgent(llm, tools, {
verbose: true,
});
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await executor.invoke({
input: "Hi, I'm Bob!",
});
// console.log(result);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result2 = await executor.invoke({
input: "What's my name?",
});
// console.log(result2);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result3 = await executor.invoke({
input: "How much money did LangCo make in July?",
});
// console.log(result3);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result4 = await executor.invoke({
input: "How about in August?",
});
Expand Down
10 changes: 10 additions & 0 deletions langchain/src/chains/openai_functions/tests/openapi.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ test("OpenAPI chain with a provided full spec", async () => {
{ llm: new ChatOpenAI({ modelName: "gpt-4-0613", temperature: 0 }) }
);

// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await chain.run(
`What are some options for a men's large blue button down shirt`
);
Expand All @@ -118,6 +120,8 @@ test("OpenAPI chain with yml spec from a URL", async () => {
llm: new ChatOpenAI({ modelName: "gpt-4-0613", temperature: 0 }),
}
);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await chain.run(`What's today's comic?`);
// console.log(result);
});
Expand All @@ -129,6 +133,8 @@ test("OpenAPI chain with yml spec from a URL with a path parameter", async () =>
llm: new ChatOpenAI({ modelName: "gpt-4-0613", temperature: 0 }),
}
);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await chain.run(`What comic has id 2184?`);
// console.log(result);
});
Expand All @@ -137,6 +143,8 @@ test("OpenAPI chain with yml spec from a URL requiring a POST request", async ()
const chain = await createOpenAPIChain("https://api.speak.com/openapi.yaml", {
llm: new ChatOpenAI({ modelName: "gpt-4-0613", temperature: 0 }),
});
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await chain.run(`How would you say no thanks in Russian?`);
// console.log(result);
});
Expand All @@ -150,6 +158,8 @@ test("OpenAPI chain with a longer spec and tricky query required params", async
},
}
);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const result = await chain.run(
"Can you find and explain some articles about the intersection of AI and VR?"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ test("Test loadQAStuffChain", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input_documents: docs, question: "Whats up" });
// console.log({ res });
});
Expand All @@ -27,6 +29,8 @@ test("Test loadQAMapReduceChain", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input_documents: docs, question: "Whats up" });
// console.log({ res });
});
Expand All @@ -38,6 +42,8 @@ test("Test loadQARefineChain", async () => {
new Document({ pageContent: "Harrison went to Harvard." }),
new Document({ pageContent: "Ankush went to Princeton." }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({
input_documents: docs,
question: "Where did Harrison go to college?",
Expand Down
2 changes: 2 additions & 0 deletions langchain/src/chains/router/tests/multi_prompt.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Here is a question:
input: "Who was the first president of the United States?",
});

// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const [{ text: result1 }, { text: result2 }, { text: result3 }] =
await Promise.all([testPromise1, testPromise2, testPromise3]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ test("Test MultiPromptChain", async () => {
});

const [
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
{ text: result1, sourceDocuments: sourceDocuments1 },
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
{ text: result2, sourceDocuments: sourceDocuments2 },
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
{ text: result3, sourceDocuments: sourceDocuments3 },
] = await Promise.all([testPromise1, testPromise2, testPromise3]);

Expand Down
6 changes: 6 additions & 0 deletions langchain/src/chains/summarization/tests/load.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ test("Test loadSummzationChain stuff", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input_documents: docs, question: "Whats up" });
// console.log({ res });
});
Expand All @@ -23,6 +25,8 @@ test("Test loadSummarizationChain map_reduce", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input_documents: docs, question: "Whats up" });
// console.log({ res });
});
Expand All @@ -35,6 +39,8 @@ test("Test loadSummarizationChain refine", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input_documents: docs, question: "Whats up" });
// console.log({ res });
});
4 changes: 4 additions & 0 deletions langchain/src/chains/tests/api_chain.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ test("Test APIChain", async () => {
};

const chain = new APIChain(apiChainInput);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({
question: "Search for notes containing langchain",
});
Expand All @@ -57,6 +59,8 @@ test("Test APIChain fromLLMAndApiDocs", async () => {
// This test doesn't work as well with earlier models
const model = new OpenAI({ modelName: "gpt-3.5-turbo-instruct" });
const chain = APIChain.fromLLMAndAPIDocs(model, OPEN_METEO_DOCS);
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({
question:
"What is the weather like right now in Munich, Germany in degrees Farenheit?",
Expand Down
6 changes: 6 additions & 0 deletions langchain/src/chains/tests/combine_docs_chain.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ test("Test StuffDocumentsChain", async () => {
new Document({ pageContent: "bar" }),
new Document({ pageContent: "baz" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.invoke({ context: docs });
// console.log({ res });
});
Expand All @@ -31,6 +33,8 @@ test("Test MapReduceDocumentsChain with QA chain", async () => {
new Document({ pageContent: "harrison went to harvard" }),
new Document({ pageContent: "ankush went to princeton" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({
input_documents: docs,
question: "Where did harrison go to college",
Expand All @@ -48,6 +52,8 @@ test("Test RefineDocumentsChain with QA chain", async () => {
new Document({ pageContent: "harrison went to harvard" }),
new Document({ pageContent: "ankush went to princeton" }),
];
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.invoke({
input_documents: docs,
question: "Where did harrison go to college",
Expand Down
2 changes: 2 additions & 0 deletions langchain/src/chains/tests/combine_docs_chain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ test("Test RefineDocumentsChain", async () => {

expect(chain.inputKeys).toEqual(["input_documents"]);

// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.run(docs);
// console.log({ res });
});
2 changes: 2 additions & 0 deletions langchain/src/chains/tests/constitutional_chain.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ test("Test ConstitutionalChain", async () => {
],
});

// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await constitutionalChain.invoke({
question: "What is the meaning of life?",
});
Expand Down
2 changes: 2 additions & 0 deletions langchain/src/chains/tests/conversation_chain.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ConversationChain } from "../conversation.js";
test("Test ConversationChain", async () => {
const model = new OpenAI({ modelName: "gpt-3.5-turbo-instruct" });
const chain = new ConversationChain({ llm: model });
// @eslint-disable-next-line/@typescript-eslint/ban-ts-comment
// @ts-expect-error unused var
const res = await chain.call({ input: "my favorite color" });
// console.log({ res });
});
Loading

0 comments on commit 62703fa

Please sign in to comment.