agsamantha/node_modules/langchain/dist/agents/load.js
2024-10-02 15:15:21 -05:00

17 lines
691 B
JavaScript

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);
};