promptulate icon indicating copy to clipboard operation
promptulate copied to clipboard

Add tool support for LLMFactory and BaseLLM

Open Undertone0809 opened this issue 6 months ago • 0 comments

🚀 Feature Request

Currently, if you use tool in pne.chat. ReAct prompt pattern will turn on default. Now lots of model support tool call, it more simple and fast. Need to add tool support for language model.

Change: when developer run the following example. Use model tool parameter default, rather than startup a Tool Agent.

import pne

def run_code(code: str):
    ...

response = pne.chat("give me a bubble sort and run it", tools=[run_code])

For LLM intergate litellm, a compatibility scheme is required. For other solutions, you need to determine whether provider is compatible with tool parameters. For details, see the implementation of langchain.

If want to use ToolAgent in pne.chat, using the following code:

import pne

def run_code(code: str):
    ...

response = pne.chat("give me a bubble sort and run it", tools=[run_code], enable_agent=True)

Undertone0809 avatar Aug 03 '24 13:08 Undertone0809