Skip to content

Commit

Permalink
chore: lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed May 2, 2024
1 parent df9851f commit dac8916
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 28 deletions.
5 changes: 1 addition & 4 deletions libs/langchain-anthropic/src/load/dynamic_import_map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Auto-generated by `scripts/create-entrypoints.js`. Do not edit manually.

export async function getDynamicImportMap() {

return {

};
return {};
}
2 changes: 0 additions & 2 deletions libs/langchain-anthropic/src/load/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@

export * as index from "../index.js";
export * as experimental from "../experimental/index.js";


9 changes: 7 additions & 2 deletions libs/langchain-anthropic/src/load/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { type OptionalImportMap, type SecretMap } from "./import_type.js";
import { load as coreLoad } from "@langchain/core/load";
import { type OptionalImportMap, type SecretMap } from "./import_type.js";
import * as importMap from "./import_map.js";
import { optionalImportEntrypoints } from "./import_constants.js";

export { optionalImportEntrypoints, importMap, type OptionalImportMap, type SecretMap };
export {
optionalImportEntrypoints,
importMap,
type OptionalImportMap,
type SecretMap,
};

/**
* Load a LangChain module from a serialized text representation.
Expand Down
5 changes: 1 addition & 4 deletions libs/langchain-community/src/load/dynamic_import_map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Auto-generated by `scripts/create-entrypoints.js`. Do not edit manually.

export async function getDynamicImportMap() {

return {

};
return {};
}
2 changes: 0 additions & 2 deletions libs/langchain-community/src/load/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ export * as document_loaders__web__serpapi from "../document_loaders/web/serpapi
export * as document_loaders__web__sort_xyz_blockchain from "../document_loaders/web/sort_xyz_blockchain.js";
export * as utils__event_source_parse from "../utils/event_source_parse.js";
export * as experimental__graph_transformers__llm from "../experimental/graph_transformers/llm.js";


9 changes: 7 additions & 2 deletions libs/langchain-community/src/load/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { type OptionalImportMap, type SecretMap } from "./import_type.js";
import { load as coreLoad } from "@langchain/core/load";
import { type OptionalImportMap, type SecretMap } from "./import_type.js";
import * as importMap from "./import_map.js";
import { optionalImportEntrypoints } from "./import_constants.js";

export { optionalImportEntrypoints, importMap, type OptionalImportMap, type SecretMap };
export {
optionalImportEntrypoints,
importMap,
type OptionalImportMap,
type SecretMap,
};

/**
* Load a LangChain module from a serialized text representation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Document } from "@langchain/core/documents";
import { OpenAIEmbeddings, OpenAI } from "@langchain/openai";
import { AttributeInfo } from "langchain/chains/query_constructor";
import { SelfQueryRetriever } from "langchain/retrievers/self_query";
import { QdrantVectorStore } from "../../vectorstores/qdrant.js";
import { QdrantClient } from "@qdrant/js-client-rest";
import { QdrantVectorStore } from "../../vectorstores/qdrant.js";
import { QdrantTranslator } from "../qdrant.js";

test("Qdrant Vector Store Self Query Retriever Test", async () => {
Expand Down
44 changes: 33 additions & 11 deletions libs/langchain-scripts/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,31 @@ export function _verifyObjectIsLangChainConfig(
!("cjsDestination" in obj) ||
!("abs" in obj)
) {
console.error(`LangChain config file is missing required fields. One of: entrypoints, tsConfigPath, cjsSource, cjsDestination, abs`);
console.error(
`LangChain config file is missing required fields. One of: entrypoints, tsConfigPath, cjsSource, cjsDestination, abs`
);
return false;
}
if (typeof obj.entrypoints !== "object") {
console.error("entrypoints field in LangChain config file is not an object");
console.error(
"entrypoints field in LangChain config file is not an object"
);
return false;
}
if (Object.values(obj.entrypoints).some((v) => typeof v !== "string")) {
console.error("entrypoints field in LangChain config file is not an object of strings");
console.error(
"entrypoints field in LangChain config file is not an object of strings"
);
return false;
}
if (
typeof obj.tsConfigPath !== "string" ||
typeof obj.cjsSource !== "string" ||
typeof obj.cjsDestination !== "string"
) {
console.error("tsConfigPath, cjsSource, or cjsDestination fields in LangChain config file are not strings");
console.error(
"tsConfigPath, cjsSource, or cjsDestination fields in LangChain config file are not strings"
);
return false;
}
if (typeof obj.abs !== "function") {
Expand All @@ -46,7 +54,9 @@ export function _verifyObjectIsLangChainConfig(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj.requiresOptionalDependency.some((v: any) => typeof v !== "string"))
) {
console.error("requiresOptionalDependency field in LangChain config file is not an array of strings");
console.error(
"requiresOptionalDependency field in LangChain config file is not an array of strings"
);
return false;
}
if (
Expand All @@ -55,7 +65,9 @@ export function _verifyObjectIsLangChainConfig(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj.deprecatedNodeOnly.some((v: any) => typeof v !== "string"))
) {
console.error("deprecatedNodeOnly field in LangChain config file is not an array of strings");
console.error(
"deprecatedNodeOnly field in LangChain config file is not an array of strings"
);
return false;
}
if (
Expand All @@ -64,25 +76,33 @@ export function _verifyObjectIsLangChainConfig(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj.deprecatedOmitFromImportMap.some((v: any) => typeof v !== "string"))
) {
console.error("deprecatedOmitFromImportMap field in LangChain config file is not an array of strings");
console.error(
"deprecatedOmitFromImportMap field in LangChain config file is not an array of strings"
);
return false;
}
if ("packageSuffix" in obj && typeof obj.packageSuffix !== "string") {
console.error("packageSuffix field in LangChain config file is not a string");
console.error(
"packageSuffix field in LangChain config file is not a string"
);
return false;
}
if (
"shouldTestExports" in obj &&
typeof obj.shouldTestExports !== "boolean"
) {
console.error("shouldTestExports field in LangChain config file is not a boolean");
console.error(
"shouldTestExports field in LangChain config file is not a boolean"
);
return false;
}
if (
"extraImportMapEntries" in obj &&
!Array.isArray(obj.extraImportMapEntries)
) {
console.error("extraImportMapEntries field in LangChain config file is not an array");
console.error(
"extraImportMapEntries field in LangChain config file is not an array"
);
return false;
}
if (
Expand All @@ -91,7 +111,9 @@ export function _verifyObjectIsLangChainConfig(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj.gitignorePaths.some((v: any) => typeof v !== "string"))
) {
console.error("gitignorePaths field in LangChain config file is not an array of strings");
console.error(
"gitignorePaths field in LangChain config file is not an array of strings"
);
return false;
}
if ("internals" in obj && !Array.isArray(obj.internals)) {
Expand Down

0 comments on commit dac8916

Please sign in to comment.