agsamantha/node_modules/langchain/dist/agents/load.js

18 lines
691 B
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
import { Agent } from "./agent.js";
import { loadFromHub } from "../util/hub.js";
import { loadFromFile } from "../util/load.js";
import { parseFileConfig } from "../util/parse.js";
/** @deprecated */
const loadAgentFromFile = async (file, path, llmAndTools) => {
const serialized = parseFileConfig(file, path);
return Agent.deserialize({ ...serialized, ...llmAndTools });
};
/** @deprecated */
export const loadAgent = async (uri, llmAndTools) => {
const hubResult = await loadFromHub(uri, loadAgentFromFile, "agents", new Set(["json", "yaml"]), llmAndTools);
if (hubResult) {
return hubResult;
}
return loadFromFile(uri, loadAgentFromFile, llmAndTools);
};