Class representing the AutoGPT concept with LangChain primitives. It is designed to be used with a set of tools such as a search tool, write-file tool, and a read-file tool.

const autogpt = AutoGPT.fromLLMAndTools(
new ChatOpenAI({ temperature: 0 }),
[
new ReadFileTool({ store: new InMemoryFileStore() }),
new WriteFileTool({ store: new InMemoryFileStore() }),
new SerpAPI("YOUR_SERPAPI_API_KEY", {
location: "San Francisco,California,United States",
hl: "en",
gl: "us",
}),
],
{
memory: new MemoryVectorStore(new OpenAIEmbeddings()).asRetriever(),
aiName: "Tom",
aiRole: "Assistant",
},
);
const result = await autogpt.run(["write a weather report for SF today"]);

Constructors

Properties

aiName: string
chain: LLMChain<string, LLMType>
feedbackTool?: Tool
fullMessageHistory: BaseMessage[]
maxIterations: number
memory: VectorStoreRetrieverInterface<VectorStoreInterface>
nextActionCount: number
outputParser: AutoGPTOutputParser
textSplitter: TokenTextSplitter
tools: ObjectTool[]

Methods

  • Runs the AI with a given set of goals.

    Parameters

    • goals: string[]

      An array of strings representing the goals.

    Returns Promise<undefined | string>

    A string representing the result of the run or undefined if the maximum number of iterations is reached without a result.

  • Creates a new AutoGPT instance from a given LLM and a set of tools.

    Parameters

    • llm: BaseChatModel<BaseChatModelCallOptions, AIMessageChunk>

      A BaseChatModel object.

    • tools: ObjectTool[]

      An array of ObjectTool objects.

    • __namedParameters: AutoGPTInput

    Returns AutoGPT

    A new instance of the AutoGPT class.