Skip to content

Commit

Permalink
chore: lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jun 12, 2024
1 parent 90179e9 commit 54f7576
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 27 deletions.
4 changes: 1 addition & 3 deletions docs/core_docs/docs/tutorials/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ const vectorstore = await MemoryVectorStore.fromDocuments(
);
const retriever = vectorstore.asRetriever();

const retrieverResult = await retriever.invoke(
"how to upload a dataset"
);
const retrieverResult = await retriever.invoke("how to upload a dataset");
console.log(retrieverResult[0]);

/*
Expand Down
4 changes: 1 addition & 3 deletions examples/src/retrievers/parent_document_retriever_rerank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ await retriever.addDocuments(docs);

// This will search for documents in vector store and return for LLM already reranked and sorted document
// with appropriate minimum relevance score
const retrievedDocs = await retriever.invoke(
"What is Pam's favorite color?"
);
const retrievedDocs = await retriever.invoke("What is Pam's favorite color?");

// Pam's favorite color is returned first!
console.log(JSON.stringify(retrievedDocs, null, 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ export class ViolationOfExpectationsChain
// Only extract the first relevant doc from the retriever. We don't need more than one.
const relevantInsightsDocuments = await Promise.all(
insights.map(async (insight) => {
const relevantInsight = await this.retriever.invoke(
insight
);
const relevantInsight = await this.retriever.invoke(insight);
return relevantInsight[0];
})
);
Expand Down
5 changes: 1 addition & 4 deletions langchain/src/retrievers/multi_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ export class MultiQueryRetriever extends BaseRetriever {
const documents: Document[] = [];
await Promise.all(
queries.map(async (query) => {
const docs = await this.retriever.invoke(
query,
runManager?.getChild()
);
const docs = await this.retriever.invoke(query, runManager?.getChild());
documents.push(...docs);
})
);
Expand Down
8 changes: 2 additions & 6 deletions langchain/src/retrievers/tests/hyde.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ test("Hyde retriever", async () => {
].map((pageContent) => new Document({ pageContent }))
);

const results = await retriever.invoke(
"What is my favourite food?"
);
const results = await retriever.invoke("What is my favourite food?");

expect(results.length).toBe(1);
console.log(results);
Expand All @@ -51,9 +49,7 @@ test("Hyde retriever with default prompt template", async () => {
].map((pageContent) => new Document({ pageContent }))
);

const results = await retriever.invoke(
"What is my favourite food?"
);
const results = await retriever.invoke("What is my favourite food?");

expect(results.length).toBe(1);
console.log(results);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ describe.skip("AzureAISearchVectorStore e2e integration tests", () => {

const standardRetriever = await vectorStore.asRetriever();

const standardRetrieverOutput =
await standardRetriever.invoke("foo");
const standardRetrieverOutput = await standardRetriever.invoke("foo");
expect(output).toHaveLength(texts.length);

const standardRetrieverActual = standardRetrieverOutput.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ describe.skip("AzureCosmosDBVectorStore", () => {

const standardRetriever = await vectorStore.asRetriever();

const standardRetrieverOutput =
await standardRetriever.invoke("foo");
const standardRetrieverOutput = await standardRetriever.invoke("foo");
expect(output).toHaveLength(texts.length);

const standardRetrieverActual = standardRetrieverOutput.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ describe("add documents and similarity search tests", () => {

const standardRetriever = vectorStore.asRetriever();

const standardRetrieverOutput =
await standardRetriever.invoke("foo");
const standardRetrieverOutput = await standardRetriever.invoke("foo");
expect(output).toHaveLength(texts.length);

const standardRetrieverActual = standardRetrieverOutput.map(
Expand Down
3 changes: 1 addition & 2 deletions libs/langchain-mongodb/src/tests/vectorstores.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ test("MongoDBAtlasVectorSearch with Maximal Marginal Relevance", async () => {

const standardRetriever = await vectorStore.asRetriever();

const standardRetrieverOutput =
await standardRetriever.invoke("foo");
const standardRetrieverOutput = await standardRetriever.invoke("foo");
expect(output).toHaveLength(texts.length);

const standardRetrieverActual = standardRetrieverOutput.map(
Expand Down

0 comments on commit 54f7576

Please sign in to comment.