Skip to content

Latest commit

 

History

History
162 lines (149 loc) · 6.56 KB

README.md

File metadata and controls

162 lines (149 loc) · 6.56 KB
EartAgent logo

English | 简体中文

license

💡 What is EartAgent?

EartAgent (Efficient and real-time Agent) is a multimodal multi-intelligent body framework, through the compatibility of the large model ecology, for the current large model exists such as outdated information, the lack of external validation, error prediction frequently, etc., EartAgent framework aims to improve the efficiency and accuracy of the large language model. The framework is lightweight and easy to use, with a range of tools such as real-time search capabilities, and improves answer accuracy through multi-intelligence collaboration and reflection mechanisms. The framework is highly compatible and provides packaging examples to realize out-of-the-box use. At high fault tolerance, we also provide wrapper examples for developers to use out of the box:

  • 😃 Example
    • Real-time voice dialog
    • Website cloning
    • Thesis writing
  • 😁 Games
    • Werewolf
    • Italian Town Life
    • moot court

📌 Recent Updates

  • 2024-07-25 soon~
  • 2024-05-31 We try our best to build the best function call.
  • 2024~~~~~~ One click to build a simpler RAG, we're working on it, stay tuned!☺️
  • 2024-05-22 Integrate model zhipuAI, add moot court games
  • 2024-05-18 Integration of the Great Model Yi!
  • 2024-05-17 EartAgent has been released on github on May 17th!
  • 2024-05-15 Integration of large models OpenAI GPT-4o, Gemini1.5pro.

🎬 Give it a Try

📝 Prerequisites

  • python >= 3.9

    If you do not have pytorch installed locally (Windows, Mac, or Linux), you can install it yourself by referring to the documentation Install pytorch. Recommended to use conda as an administrative tool, you can create a new Python 3.9 virtual environment with the following command: Creating a conda environment

    conda create -n EartAgent python=3.9
    conda activate EartAgent

    Pulling items

    git clone https://github.com/haijian-wang/EartAgent.git
    cd EartAgent

    Installation of dependencies

    pip install -r requirements.txt

🚀 Getting Started Quickly

  1. In the following examples we use the China Tongyi Big Model as an example:

    You need to apply api_key in advance, apply according to your needs:

    import EartAgent
    
    form EartAgent.Agent.text_Agent import *
    
    QwenAgent.api_key = "your_api_key"
    agent = QwenAgent(
    config=AgentConfig(name='kerry', system_prompt=""))
    x = 'Hi kerry'
    agent(x)

    Memory is not turned on by default because it will cost you more tokens, but of course it is convenient to turn it on

    agent = QwenAgent(
      config=AgentConfig(name='kerry', system_prompt="",remember=True)
    )

    We also support uploading all files and URLs to make Agent replies more what you want them to be.

    agent(x,url='')
  2. Multi-intelligentsia coordinated work and communication:

    Multi-intelligence collaboration can greatly prompt the accuracy of responses, and MsgHub and Pipeline are the main means of communication between intelligences in EartAgent If we want agent_1 and agent_2 to communicate then it would be

    while True:
     x = agent_1t(x)
     x = agent_2(x)
    
    # If the user types “exit”, terminate the dialog.
    if x.content == "exit":
      print(“Exiting the conversation.”)
      break

    Simpler you just need, EartAgent provides the option of Pipeline to maintain the flow of messages between intelligences

    pipeline = Pipeline(agent_list=[agent_1, agent_2])
    final_response = pipeline.execute_pipeline(initial_message=Initial message to pipeline”)

    Actually agent can also communicate in group chats

    hub = MsgHub(agent_list)
    hub.broadcast_message(“Hello, everyone.”)
    hub.execute_pipeline()

    You can also add and remove members to the group chat as you wish.

    hub.add_agent(agent_3)
    hub.remove_agent(agent_3)
  3. We have prepared a rich set of tools for Agents to use, such as Smart Body Networking.

    But here we need to request search_api_key.

    agent_1 = QwenAgent(
    config=AgentConfig(name='Kerry',
    system_prompt=You're a good helper.", system_prompt="You're a good helper."
    tool_use=[
    {'name': 'serpapi_search', 'api_key': 'your_search_api_key'}
    ]))
  4. There are many more tools available to us, as follows, and UtilityTools is full of them for you to explore.

    UtilityTools has many tools for you to explore.

    from EartAgent.utils.UT import UtilityTools
    tools = UtilityTools()

🚀 Encapsulation Examples

  1. In EartAgent we provide a lot of out-of-the-box wrapper examples for developers to use, such as (website cloning, essay writing, real-time voice dialog, etc.). How to use it? Let's take real-time voice dialog as an example

    Still need to apply for api_key in advance, according to your needs to apply:

    from EartAgent.app_packaging.voice_dialog_assistant import VoiceAssistant
    assistant = VoiceAssistant(api_key=your_api_key”)
    assistant.run()        

🤗 Reflection mechanism

  1. In EartAgent we can have the Agent reflect on itself to output better answers
    from EartAgent.thinking.reflector import AgentReflector
    qwen_reflector = AgentReflector(qwen_agent)
    # Here you can define the number of reflections   
    reflected_content = qwen_reflector.Mreflect(reflection_count=3)        

🤪 There's more to the framework

🙂 Feel free to contact me for a discussion

  • 😃 email:[email protected]
  • 🫡 Wechat:AI_nlp_john
  • 🤓 Thank you to everyone who helped me.

⭐ Star History

[Star History Chart](https://star-history.com/#Haijian06/EartAgent&Date)