Skip to content

phuvinhnguyen/FlowDesign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design flow for LLM

Features and tasks

  • Database for retrieval system
    • Faiss database
    • Graph search
  • Online searching
    • DuckduckGo search
  • LLM
    • OpenAI
    • Gemini
    • HuggingFace
  • Flow
    • PAL flow
  • Documents

How to install

pip install git+https://github.com/phuvinhnguyen/FlowDesign.git

Example use

This framework can be used to create new flow easily, for example:

from FlowDesign.processor import *

class PALFlow:
    def __init__(self, chatbot, working_dir='.'):
        nlp = TextProcessor(chatbot, 'Write a executable Python program to solve the problem: {query}', 'llm')
        parser = ParseCodeProcessor('{llm}')
        exec = PythonProcessor(working_dir=working_dir)
        self.flow = nlp*parser*exec # ask llm to gen code -> parse code -> exec code

    def chat(self, query: str) -> str:
        result = self.flow(IOBase({'query': query})).run
        return result['program_out'] if result['program_out'] != None else result['program_err']

How to use the built-in PAL flow with gemini

from FlowDesign.flow.pal import PALFlow
from FlowDesign.chatbot.base import GeminiBot

bot = GeminiBot('GEMINI_TOKEN')
flow = PALFlow(bot)
output1 = flow.chat('what is the result of (1231.23*3242.432^2)/7?+pi^(2^pi)-e^(pi^2)') # can be difficult even with GPT4
output2 = flow.chat('sort this list: [1,232,4,432,34,25,13,31,23,32,324,3,5,23,32,3,2,2,2,2,2,2,2,2,2,2,2,2]') # can be very difficult with the list is larger (1000 numbers for example) even with CoT, ToT, GoT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages