{"id":13456568,"url":"https://github.com/MLT-OSS/open-assistant-api","last_synced_at":"2025-03-24T11:30:41.237Z","repository":{"id":215249299,"uuid":"738471678","full_name":"MLT-OSS/open-assistant-api","owner":"MLT-OSS","description":"The Open Assistant API is a ready-to-use, open-source, self-hosted agent/gpts orchestration creation framework, supporting customized extensions for LLM, RAG, function call, and tools capabilities. It also supports seamless integration with the openai/langchain sdk.","archived":false,"fork":false,"pushed_at":"2024-09-13T06:20:04.000Z","size":1942,"stargazers_count":254,"open_issues_count":1,"forks_count":47,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-09-13T17:54:16.523Z","etag":null,"topics":["agent","ai","assistants","assistants-api","chatgpt","gpt","gpt-4","gpts","langchain","llm","openai","openai-api","openai-assistants","openai-assistants-api","python","rag","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MLT-OSS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-03T09:57:54.000Z","updated_at":"2024-09-13T06:20:08.000Z","dependencies_parsed_at":"2024-05-03T23:28:02.189Z","dependency_job_id":"1b9ab94d-a531-4d8c-89e8-c585a812155e","html_url":"https://github.com/MLT-OSS/open-assistant-api","commit_stats":null,"previous_names":["tuanzi1015/open-assistant-api","mlt-oss/open-assistant-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLT-OSS%2Fopen-assistant-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLT-OSS%2Fopen-assistant-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLT-OSS%2Fopen-assistant-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLT-OSS%2Fopen-assistant-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MLT-OSS","download_url":"https://codeload.github.com/MLT-OSS/open-assistant-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221962409,"owners_count":16908336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","assistants","assistants-api","chatgpt","gpt","gpt-4","gpts","langchain","llm","openai","openai-api","openai-assistants","openai-assistants-api","python","rag","self-hosted"],"created_at":"2024-07-31T08:01:24.235Z","updated_at":"2024-10-29T00:30:39.343Z","avatar_url":"https://github.com/MLT-OSS.png","language":"Python","funding_links":[],"categories":["Python","Learning"],"sub_categories":["Repositories"],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Open Assistant API\n\n_✨ An out-of-the-box AI intelligent assistant API ✨_\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"./README.md\"\u003eEnglish\u003c/a\u003e |\n  \u003ca href=\"./README_CN.md\"\u003e简体中文\u003c/a\u003e |\n  \u003ca href=\"./README_JP.md\"\u003e日本語\u003c/a\u003e\n\u003c/p\u003e\n\n## Introduction\n\nOpen Assistant API is an open-source, self-hosted AI intelligent assistant API, compatible with the official OpenAI\ninterface. It can be used directly with the official OpenAI [Client](https://github.com/openai/openai-python) to build\nLLM applications.\n\nIt supports [One API](https://github.com/songquanpeng/one-api) for integration with more commercial and private models.\n\nIt supports [R2R](https://github.com/SciPhi-AI/R2R) RAG engine。\n\n## Usage\n\nBelow is an example of using the official OpenAI Python `openai` library:\n\n```python\nimport openai\n\nclient = openai.OpenAI(\n    base_url=\"http://127.0.0.1:8086/api/v1\",\n    api_key=\"xxx\"\n)\n\nassistant = client.beta.assistants.create(\n    name=\"demo\",\n    instructions=\"You are a helpful assistant.\",\n    model=\"gpt-4-1106-preview\"\n)\n```\n\n## Why Choose Open Assistant API\n\n| Feature                  | Open Assistant API | OpenAI Assistant API |\n|--------------------------|--------------------|----------------------|\n| Ecosystem Strategy       | Open Source        | Closed Source        |\n| RAG Engine               | Support R2R        | Supported            |\n| Internet Search          | Supported          | Not Supported        |\n| Custom Functions         | Supported          | Supported            |\n| Built-in Tool            | Extendable         | Not Extendable       |\n| Code Interpreter         | Under Development  | Supported            |\n| Multimodal               | Supported          | Supported            |\n| LLM Support              | Supports More LLMs | Only GPT             |\n| Message Streaming Output | Supports           | Supported            |\n| Local Deployment         | Supported          | Not Supported        |\n\n- **LLM Support**: Compared to the official OpenAI version, more models can be supported by integrating with One API.\n- **Tool**: Currently supports online search; can easily expand more tools.\n- **RAG Engine**: The currently supported file types are txt, html, markdown, pdf, docx, pptx, xlsx, png, mp3, mp4, etc. We provide a preliminary\n  implementation.\n- **Message Streaming Output**: Support message streaming output for a smoother user experience.\n- **Ecosystem Strategy**: Open source, you can deploy the service locally and expand the existing features.\n\n## Quick Start\n\nThe easiest way to start the Open Assistant API is to run the docker-compose.yml file. Make sure Docker and Docker\nCompose are installed on your machine before running.\n\n### Configuration\n\nGo to the project root directory, open `docker-compose.yml`, fill in the openai api_key and bing search key (optional).\n\n```sh\n# openai api_key (supports OneAPI api_key)\nOPENAI_API_KEY=\u003copenai_api_key\u003e\n\n# bing search key (optional)\nBING_SUBSCRIPTION_KEY=\u003cbing_subscription_key\u003e\n```\n\nIt is recommended to configure the R2R RAG engine to replace the default RAG implementation to provide better RAG capabilities.\nYou can learn about and use R2R through the [R2R Github repository](https://github.com/SciPhi-AI/R2R).\n\n```sh\n# RAG config\n# FILE_SERVICE_MODULE=app.services.file.impl.oss_file.OSSFileService\nFILE_SERVICE_MODULE=app.services.file.impl.r2r_file.R2RFileService\nR2R_BASE_URL=http://\u003cr2r_api_address\u003e\nR2R_USERNAME=\u003cr2r_username\u003e\nR2R_PASSWORD=\u003cr2r_password\u003e\n```\n\n### Run\n\n#### Run with Docker Compose:\n\n ```sh\ndocker compose up -d\n ```\n\n### Access API\n\nApi Base URL: http://127.0.0.1:8086/api/v1\n\nInterface documentation address: http://127.0.0.1:8086/docs\n\n### Complete Usage Example\n\nIn this example, an AI assistant is created and run using the official OpenAI client library. If you need to explore other usage methods,\nsuch as streaming output, tools (web_search, retrieval, function), etc., you can find the corresponding code under the examples directory.\nBefore running, you need to run `pip install openai` to install the Python `openai` library.\n\n```sh\n# !pip install openai\nexport PYTHONPATH=$(pwd)\npython examples/run_assistant.py\n```\n\n\n### Permissions\nSimple user isolation is provided based on tokens to meet SaaS deployment requirements. It can be enabled by configuring `APP_AUTH_ENABLE`.\n\n![](docs/imgs/user.png)\n\n1. The authentication method is Bearer token. You can include `Authorization: Bearer ***` in the header for authentication.\n2. Token management is described in the token section of the API documentation. Relevant APIs need to be authenticated with an admin token, which is configured as `APP_AUTH_ADMIN_TOKEN` and defaults to \"admin\".\n3. When creating a token, you need to provide the base URL and API key of the large model. The created assistant will use the corresponding configuration to access the large model.\n\n### Tools\nAccording to the OpenAPI/Swagger specification, it allows the integration of various tools into the assistant, empowering and enhancing its capability to connect with the external world.\n\n1. Facilitates connecting your application with other systems or services, enabling interaction with the external environment, such as code execution or accessing proprietary information sources.\n2. During usage, you need to create tools first, and then you can integrate them with the assistant. Refer to the test cases for more details.[Assistant With Action](tests/tools/assistant_action_test.py)\n3. If you need to use tools with authentication information, simply add the authentication information at runtime. The specific parameter format can be found in the API documentation. Refer to the test cases for more details. [Run With Auth Action](tests/tools/run_with_auth_action_test.py)\n\n\n## Community and Support\n\n- Join the [Slack](https://join.slack.com/t/openassistant-qbu7007/shared_invite/zt-29t8j9y12-9og5KZL6GagXTEvbEDf6UQ)\n  channel to see new releases, discuss issues, and participate in community interactions.\n- Join the [Discord](https://discord.gg/VfBruz4B) channel to interact with other community members.\n- Join the WeChat group:\n\n  ![](docs/imgs/wx.png)\n\n## Special Thanks\n\nWe mainly referred to and relied on the following projects:\n\n- [OpenOpenAI](https://github.com/transitive-bullshit/OpenOpenAI): Assistant API implemented in Node\n- [One API](https://github.com/songquanpeng/one-api): Multi-model management tool\n- [R2R](https://github.com/SciPhi-AI/R2R): RAG engine\n- [OpenAI-Python](https://github.com/openai/openai-python): OpenAI Python Client\n- [OpenAI API](https://github.com/openai/openai-openapi): OpenAI interface definition\n- [LangChain](https://github.com/langchain-ai/langchain): LLM application development library\n- [OpenGPTs](https://github.com/langchain-ai/opengpts): LangChain GPTs\n- [TaskingAI](https://github.com/TaskingAI/TaskingAI): TaskingAI Client SDK\n\n## Contributing\n\nPlease read our [contribution document](./docs/CONTRIBUTING.md) to learn how to contribute.\n\n## Open Source License\n\nThis repository follows the MIT open source license. For more information, please see the [LICENSE](./LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMLT-OSS%2Fopen-assistant-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMLT-OSS%2Fopen-assistant-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMLT-OSS%2Fopen-assistant-api/lists"}