aboutsummaryrefslogtreecommitdiff
path: root/tools/get_user_inputs.py
blob: e219babe50221e28182fe4e640e305d5ead128d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import List
from langchain.agents import tool

from dotenv import load_dotenv

from langchain.agents import load_tools
from langchain.llms import OpenAI
from langchain.agents import initialize_agent, AgentType

load_dotenv()

import os

INPUTS = {}


@tool("get_desired_inputs")
def get_desired_inputs(input: str) -> dict:
    """Use this between tools to get the desired inputs for the next tool.
    You will be given a task that will be performed by an autonomous agent on behalf of a user. You will gather any necessary data from the user to complete the specified task before executing the task.
    """

    prompt = input

    llm = OpenAI(temperature=0)
    agent = initialize_agent(
        tools=load_tools(["human"]),
        llm=llm,
        agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    )

    return agent.run(prompt)


def get_user_inputs():
    # iterate through INPUTS and populate values
    print("Done")