|
20 | 20 |
|
21 | 21 | ## 🚀 Overview |
22 | 22 |
|
23 | | -This is a sub-project of **LFDT Labs AIFAQ Prototype (Studio Branch)**. The main goal is to build an AI agent that interacts with the communities to get feedback from potential users. |
| 23 | +The **Hyperledger Labs AIFAQ Prototype (Agents Branch)** is an open-source conversational AI tool that simplifies knowledge discovery within vast document repositories. Our mission: to **support users, developers, and communities by providing an intuitive conversational interface** that answers questions about specific contexts—no more wading through oceans of documents! |
| 24 | + |
| 25 | +👉 Official Wiki Pages: |
| 26 | + |
| 27 | +- [Hyperledger Labs Wiki](https://lf-hyperledger.atlassian.net/wiki/spaces/labs/pages/20290949/AI+FAQ+2025) |
| 28 | + |
| 29 | +👉 Weekly Community Calls: |
| 30 | + |
| 31 | +- Every Monday (public) — join via [Hyperledger Labs Calendar](https://wiki.hyperledger.org/display/HYP/Calendar+of+Public+Meetings). |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 🧩 Features |
| 36 | + |
| 37 | +- Conversational AI for targeted question answering |
| 38 | +- Supports RAG (Retrieval Augmented Generation) for enhanced accuracy |
| 39 | +- Easy integration via API and UI samples |
| 40 | +- Extensible architecture for multi-agent support |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## 🛠️ Architecture |
| 45 | + |
| 46 | +<img src="./images/architecture.png" alt="LLM chatbot architecture" width="750"/> |
| 47 | + |
| 48 | +**Workflows:** |
| 49 | + |
| 50 | +1. **Data Ingestion:** Load context documents → create vector DB (e.g., from ReadTheDocs or GitHub issues/PRs) |
| 51 | +2. **Chat Workflow:** Accept user queries → retrieve context → generate answer |
| 52 | + |
| 53 | +Currently uses [Mistral Models](https://mistral.ai) (e.g., Mixtral-8x7B-v0.1). Plans to evaluate other open-source models in the future. |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## 📝 Setup (Agents Branch) |
| 58 | + |
| 59 | +```bash |
| 60 | +git clone https://github.com/hyperledger-labs/aifaq.git |
| 61 | +cd aifaq |
| 62 | +git checkout agents |
| 63 | +python -m venv venv |
| 64 | +source venv/bin/activate |
| 65 | +cd src/mvt |
| 66 | +pip install -r requirements.txt |
| 67 | +python create_directories.py |
| 68 | +``` |
| 69 | + |
| 70 | +### Environment Variables |
| 71 | + |
| 72 | +Edit your `.env` file: |
| 73 | + |
| 74 | +```env |
| 75 | +MISTRALAI_API_KEY=<required - get from https://auth.mistral.ai/ui/login> |
| 76 | +OPENAI_API_KEY=<optional> |
| 77 | +HF_TOKEN=<required - get from https://huggingface.co/settings/tokens> |
| 78 | +``` |
| 79 | + |
| 80 | +<img src="./images/mistral.png" alt="Mistral API Key" width="500" height="300"/> |
| 81 | +<img src="./images/access_token.png" alt="HF Access Token" width="500" height="300"/> |
| 82 | + |
| 83 | +👉 Visit [Mixtral-8x7B-v0.1 on HuggingFace](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) and request access. |
| 84 | +<img src="./images/hf_request.png" alt="HF Model Request" width="500" height="300"/> |
| 85 | + |
| 86 | +### Launch |
| 87 | + |
| 88 | +The application supports two modes of operation: |
| 89 | + |
| 90 | +#### Production Mode (Default) |
| 91 | +```bash |
| 92 | +streamlit run app.py |
| 93 | +``` |
| 94 | + |
| 95 | +**Note:** Production mode requires authentication credentials to be configured in `.streamlit/secrets.toml`. If credentials are not configured, the application will show an error message with options to either: |
| 96 | +- Switch to development mode |
| 97 | +- Configure the required credentials |
| 98 | + |
| 99 | +#### Development Mode |
| 100 | +```bash |
| 101 | +streamlit run app.py dev |
| 102 | +``` |
| 103 | + |
| 104 | +**Note:** Development mode provides full functionality without authentication requirements, making it ideal for testing and development. |
| 105 | + |
| 106 | +### Authentication Configuration (Production Mode) |
| 107 | + |
| 108 | +For production mode, you need to configure authentication credentials in `.streamlit/secrets.toml`: |
| 109 | + |
| 110 | +```toml |
| 111 | +# For Auth0 authentication |
| 112 | +[auth.auth0] |
| 113 | +domain = "your-domain.auth0.com" |
| 114 | +client_id = "your-client-id" |
| 115 | +client_secret = "your-client-secret" |
| 116 | +server_metadata_url = "https://your-domain.auth0.com/.well-known/openid_configuration" |
| 117 | +client_kwargs = { "prompt" = "login"} |
| 118 | + |
| 119 | +# OR for Google OAuth |
| 120 | +[auth.google] |
| 121 | +client_id = "your-google-client-id" |
| 122 | +client_secret = "your-google-client-secret" |
| 123 | +server_metadata_url = "https://accounts.google.com/.well-known/openid_configuration" |
| 124 | + |
| 125 | +# General auth settings |
| 126 | +[auth] |
| 127 | +redirect_uri = "your-redirect-uri" |
| 128 | +cookie_secret = "your-cookie-secret" |
| 129 | +``` |
| 130 | + |
| 131 | +<img src="./images/add_knowledge.png" alt="HF Access Token" width="500" height="300"/> |
| 132 | +<img src="./images/update_knowledge.png" alt="HF Access Token" width="500" height="300"/> |
| 133 | + |
| 134 | +🎉 Access the demo at: [http://3.225.169.87:8502/](http://3.225.169.87:8502/) |
| 135 | +<img src="./images/AIFAQ.png" alt="HF Access Token" width="500" height="300"/> |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## 🌐 Open Source License |
| 140 | + |
| 141 | +- **License:** Apache 2.0 (see [`LICENSE`](./LICENSE) and [`NOTICE`](./docs/NOTICE)) |
| 142 | +- **3rd Party Libraries:** [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html) |
| 143 | +- **License Assembly:** [Assembling LICENSE and NOTICE](https://infra.apache.org/licensing-howto.html#mod-notice) |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## 🤝 Contributing |
| 148 | + |
| 149 | +We welcome contributions! Please check our [CONTRIBUTING](./docs/CONTRIBUTING.md) guidelines and [Antitrust Policy and Code of Conduct](https://lf-hyperledger.atlassian.net/wiki/spaces/HIRC/pages/19169404/Anti-trust+Policy+Notice+Code+of+Conduct). |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +## 📆 Join Us! |
| 154 | + |
| 155 | +Join our weekly public calls every Monday! See the [Hyperledger Labs Calendar](https://wiki.hyperledger.org/display/HYP/Calendar+of+Public+Meetings) for details. |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## 📢 Stay Connected |
| 160 | + |
| 161 | +- [Slack Discussions](https://join.slack.com/t/aifaqworkspace/shared_invite/zt-337k74jsl-tvH_4ct3zLj99dvZaf9nZw) |
| 162 | +- [Hyperledger Labs Community](https://lf-hyperledger.atlassian.net/wiki/spaces/labs/pages/20290949/AI+FAQ+2025) |
| 163 | +- Official Website: [aifaq.pro](https://aifaq.pro) |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## ⭐️ Star Graph |
| 168 | + |
| 169 | + |
0 commit comments