當前位置: 華文頭條 > 推薦

Open Assistant - 在強化的數據私密保護下更好的使用大模型

2024-01-02推薦

大家好,又見面了,我是 GitHub 精選君!

背景介紹

在開發過程中,我們常常需要和各種 AI 助手打交道,以實作各種復雜的任務。然而,許多現有的 AI 助手都有一個共同的問題,即它們都需要線上環境來完成程式碼執行,並且需要將我們的檔上傳到 AI 提供商的伺服器上。這樣不僅帶來了數據私密、檔大小和數量限制以及基於雲的費用等問題,而且在很大程度上限制了開發者的操作靈活性。

今天要給大家推薦一個 GitHub 開源專案 YORG-AI/Open-Assistant,該專案在 GitHub 有超過 1.2k Star,就是嘗試更好的解決以上問題。

專案介紹

Open Assistant 專案基於 OpenAI 的助手 API 開發,其主要目標是幫助開發者在本地執行程式碼、從本地檔中檢索知識(無需將其發送到 OpenAI)並提供更多的對開發者友好的工具。專案的核心優勢包括強化的數據私密保護,沒有任何檔大小和數量的限制,能夠降低使用基於雲服務的成本,並提供使用你選擇的大型語言模型(LLM)的靈活性。

同時該專案還提供一個 Web 頁面方便我們更好的使用:

如何使用

透過如下 pip 命令可以快速安裝並使用。

pip install yorgassistant

開始使用之前,首先需要設定好 API Key 和需要使用到的工具,對應如下配置:

對應的工具分為函數(Function)工具以及有狀態(Stateful)的工具。都可以透過 Python 的裝飾器很容易的進行建立,以下範例為一個 Function Tool :

from yorgassistant.core.assistant.tools.tools import register_function_tool@register_function_tooldef code_test(code: str): return { "type": "success", "content": { "result": "Hello, World!", }, }

最後就可以開始使用了,以下是一段範例程式碼,僅供參考:

import yorgassistantyorgassistant.Threads.set_threads_yaml_path('data/threads.yaml')yorgassistant.Assistants.set_assistants_yaml_path('data/assistants.yaml')yorgassistant.Tools.set_tools_yaml_path('tools.yaml')threads = yorgassistant.Threads.create()print(threads.id)assistant = yorgassistant.Assistants.create(name="Test Assistant", model="gpt-4-1106-preview", instructions="Use swe tool auto fix code files", tools=[{'type':'swe_tool'}])print(assistant.id)result = threads.run(assistant.id, "Use SoftWare Engineer Agent swe tool auto fix code files.")print(result)result = threads.run(assistant.id, "the repo url is https://github.com/YORG-AI/Open-Assistant",goto="stage_1")print(result)result = threads.run(assistant.id, "add helloworld feature to readme", goto="stage_2")print(result)result = threads.run(assistant.id, "focus_files_name_list = [README.md]", goto="stage_3")print(result)result = threads.run(assistant.id, "action=3", goto="stage_4")print(result)result = threads.run(assistant.id, "", goto="stage_5")print(result)result = threads.run(assistant.id, "action=0,action_idx=0", goto="stage_6")print(result)result = threads.run(assistant.id, "", goto="finish")print(result)

專案推介

雖然專案尚處於早期階段,但它的獨特性和功能豐富性使得它得到了越來越多開發者的關註。如果你正在尋找一款可以強化你的數據私密,完全控制程式碼執行環境,節省開發成本並提供豐富的開發工具的 AI 助手,那麽 Open Assistant 是你的一個選擇。

以下是該專案 Star 趨勢圖(代表專案的活躍程度):

更多專案詳情請檢視如下連結。

開源專案地址:https://github.com/YORG-AI/Open-Assistant

開源專案作者:YORG-AI

以下是參與專案建設的所有成員:

關註我們,一起探索有意思的開源專案。