Undertone0809 / promptulate

🚀Lightweight Large language model automation and Autonomous Language Agents development framework. Build your LLM Agent Application in a pythonic way!
https://promptulate.cn/
Apache License 2.0
334 stars 34 forks source link

add file operator for ToolAgent #115

Closed Undertone0809 closed 7 months ago

Undertone0809 commented 1 year ago

🚀 Feature Request

Add file operator like langchain file operator.

We seem need the following tools:

WriteFileTool
AppendFileTool # Attach information to an existing file
ReadFileTool
DeleteFileTool
ListDirectoryTool
CopyFileTool
MoveFileTool

ToolKit maybe a better solution if you want to use multiple tools at once.

ref: https://python.langchain.com/docs/integrations/tools/filesystem

A Possible Example Usage

Here is a possible way to use it.

from promptulate.tools.file import WriteFileTool, ReadFileTool
from promptulate.agent import ToolAgent

def main():
    tools = [WriteFileTool(), ReadFileTool()]
    agent = ToolAgent(tools=tools)
    agent.run("Please help me write a poetry in poetry.txt")

Challenges

Goal

Undertone0809 commented 1 year ago

Can you do that? @Hizeros

Undertone0809 commented 10 months ago

Now we should use function type declaration to build Tool.

ref: https://undertone0809.github.io/promptulate/#/modules/tools/custom_tool_usage?id=custom-tool

Undertone0809 commented 10 months ago

🚀 Feature Request

Add file operator like langchain file operator.

We seem need the following tools:

WriteFileTool
AppendFileTool # Attach information to an existing file
ReadFileTool
DeleteFileTool
ListDirectoryTool
CopyFileTool
MoveFileTool

ToolKit maybe a better solution if you want to use multiple tools at once.

ref: https://python.langchain.com/docs/integrations/tools/filesystem

Example Usage

Here is a possible way to use it.

from promptulate.tools.file import WriteFileTool, ReadFileTool
from promptulate.agent import ToolAgent

def main():
    tools = [WriteFileTool(), ReadFileTool()]
    agent = ToolAgent(tools=tools)
    agent.run("Please help me write a poetry in poetry.txt")

Challenges

  • initialize work directory.

Goal

  • ToolAgent can use file operator
  • Provide relevant docs
  • Add a example
  • Add relevant unittest

The upper proposal is banned. Now Promptulate use function declaration to define custom tool. We should build a function type tool for File Operation.