halbot
Just another `ChatGPT` / `Gemini` / `Mistral (by ollama)` Telegram bob, which is simple design, easy to use, extendable and fun.
Stars: 100
halbot is a Telegram bot that uses ChatGPT, Gemini, Mistral, and other AI engines to provide a variety of services, including text generation, translation, summarization, and question answering. It is easy to use and extend, and it can be integrated into your own projects. halbot is open source and free to use.
README:
Just another ChatGPT
/ Gemini
/ Mistral (by ollama)
Telegram bob, which is simple design, easy to use, extendable and fun.
Live demo, click to watch on YouTube:
-
Telegram Bot (
Telegram Bot
token required) -
ChatGPT (
OpenAI
API key required) -
Gemini (
Google Vertex AI
credentials required) -
Mistral (Install Ollama and enable
Mistral
) - Speech-to-Text (
OpenAI
orGoogle Cloud
API key required, or your own engine) - Text-to-Speech (
OpenAI
orGoogle Cloud
API key required, or your own engine) - Text-to-Image by DALL·E (
OpenAI
API key required, or your own engine) - OCR/OBJECT_DETECT (
Google Cloud
API key required, or your own engine) - Feeding webpage and YouTube to enhance your prompt
- Custom prompt and 🧠 Awesome ChatGPT Prompts at your fingertips
- Support
private
andpublic
mode, with multiple authenticate methods. -
Middleware
style workflow, easy to extend. - Built-in support parsing webpages,
YouTube
videos, PDFs, images, Office documents, code files, text files... - Realtime stream-style response, no more waiting.
- Markdown rendering for GhatGPT
- Reference rendering for Bing Chat
- Code block rendering, developers friendly.
- ESM from the ground up
Make the halbot
json config file and put it in this path ~/.halbot.json
.
Basic config demo:
{
"telegramToken": "[[Telegram Bot API Token]]",
"openaiApiKey": "[[OpenAI API Key]]"
}
All supported configuration fields:
{
// REQUIRED, string.
"telegramToken": "[[Telegram Bot API Token]]",
// Set some of these fields if you need ChatGPT, Whisper, Embedding features.
// OPTIONAL, string.
"openaiApiKey": "[[OpenAI API Key]]",
// OPTIONAL, string.
"openaiEndpoint": "[[Custom OpenAI API endpoint]]",
// OPTIONAL, string, default: "gpt-3.5-turbo".
"chatGptModel": "[[Custom ChatGPT Model ID]]",
// OPTIONAL, integer, default: 0.
"chatGptPriority": "[[Custom ChatGPT Priority]]",
// Set some of these fields if you need to use custom ChatGPT API.
// OPTIONAL, string.
"chatGptApiKey": "[[Custom ChatGPT API Key]]",
// OPTIONAL, string.
"chatGptEndpoint": "[[Custom ChatGPT API endpoint]]",
// Set this field if you need Gemini features.
// OPTIONAL, string.
"googleCredentials": "[[Google Cloud Credentials]]",
// OPTIONAL, string.
"googleProject": "[[Google Cloud Project ID]]",
// OPTIONAL, string, default: "gemini-pro-vision".
"geminiModel": "[[Custom Gemini Model ID]]",
// OPTIONAL, integer, default: 1.
"geminiPriority": "[[Custom Gemini Priority]]",
// Set this field if you need Mistral features.
// OPTIONAL, boolean.
"mistralEnabled": "[[Enable Mistral hosted by Ollama]]",
// OPTIONAL, string.
"mistralEndpoint": "[[Custom Mistral API endpoint]]",
// OPTIONAL, string, default: "Mistral" (Mistral 7B).
"mistralModel": "[[Custom Mistral Model ID]]",
// OPTIONAL, integer, default: 2.
"mistralPriority": "[[Custom Mistral Priority]]",
// OPTIONAL, string.
// Set this field if you need Google's TTS/STT/OCR/OBJECT_DETECT/Embedding.
"googleApiKey": "[[Google Cloud API Key]]",
// OPTIONAL, undefined || array of string.
// To open the bot to PUBLIC, DO NOT set this field;
// To restrict the bot to PRIVATE, set chat/group/channel ids in this array.
"private": ["[[CHAT_ID]]", "[[GROUP_ID]]", "[[CHANNEL_ID]]", ...],
// OPTIONAL, string.
// Set this field if you want to use a `magic word` to authenticate the bot.
"magicWord": "[[Your Magic Word here]]",
// OPTIONAL, string.
// Use a HOME GROUP to authentication users.
// Anyone in this group can access the bot.
"homeGroup": "[[GROUP_ID]]",
// OPTIONAL, array of enum string.
// Enum: 'private', 'mention', 'group', 'channel'.
// Defaule: ['private', 'mention'].
// By default, it will only reply to `private` chats and group `mention`s.
// Adding 'group' or 'channel' may cause too much disturbance.
"chatType": ["mention", "private"],
// OPTIONAL, string.
"hello": "[[initial prompt]]",
// OPTIONAL, string.
"info": "[[bot description]]",
// OPTIONAL, string.
"help": "[[help information]]",
// OPTIONAL, object.
// Sessions/conversations storage.
// support PostgreSQL, MariaDB/MySQL and Redis for now.
// If omitted, the bot will use memory storage and sync to this file.
// Example: (Compatibility: https://node-postgres.com/apis/pool)
"storage": {
"provider": "POSTGRESQL",
"host": "[[DATABASE HOST]]",
"database": "[[DATABASE NAME]]",
"user": "[[DATABASE USER]]",
"password": "[[DATABASE PASSWORD]]",
"vector": true, // REQUIRED
...[[OTHER DATABASE OPTIONS]],
},
// OR: (Compatibility: https://github.com/sidorares/node-mysql2)
"storage": {
"provider": "[["MARIADB" || "MYSQL"]]",
"host": "[[DATABASE HOST]]",
"database": "[[DATABASE NAME]]",
"user": "[[DATABASE USER]]",
"password": "[[DATABASE PASSWORD]]",
"charset": "utf8mb4", // REQUIRED
...[[OTHER DATABASE OPTIONS]],
},
// OR: (Compatibility: https://github.com/luin/ioredis)
"storage": {
"provider": "REDIS",
"host": "[[REDIS HOST]]",
"password": "[[REDIS PASSWORD]]",
...[[OTHER REDIS OPTIONS]],
},
}
In peace-of-mind:
$ npx halbot
If you have multible AI engines configed, use '/chatgpt' or '/bing' to switch between them, or you can use '/*' to ask them all at the same time.
Install:
$ npm i halbot
Code:
import halbot from 'halbot';
const config = {
// ...[[ALL THE CONFIG FIELDS SUPPORTED ABOVE]]],
// OPTIONAL, function.
// Your own authentication logic.
// return true if the user is authenticated.
// return false if the user is not authenticated.
auth: async (ctx) => {
// ctx is the `telegraf` context object: https://telegraf.js.org/#context-class
// It has been extended: https://github.com/Leask/utilitas/blob/master/lib/bot.mjs
return true;
},
// OPTIONAL, object (key renderd as name) or array (name ignored).
ai: {
[[aiNameA]]: [[aiConfigA]],
[[aiNameB]]: [[aiConfigB]],
// ...
},
// OPTIONAL, object.
// Your own speech-to-text and text-to-speech engine.
speech: {
stt: [[sttApi]],
tts: [[ttsApi]],
},
// OPTIONAL, object.
// Your own computer-vision engine.
vision: {
see: [[ocrAndObjectDetectApi]],
read: [[documentAnnotateApi]],
},
// OPTIONAL, object.
// Your own image-generator engine.
image: {
generate: [[textToImageApi]],
},
// OPTIONAL, string.
// Path to your own middlewares.
// ./skills
// |- skill_a.mjs
// | const action = async (bot) => {
// | bot.use(async (ctx, next) => {
// | ctx.reply('42');
// | await next();
// | });
// | };
// |
// | export const { run, priority, func } = {
// | run: true,
// | priority: 100,
// | func: action,
// | };
skillPath: [[pathToYourMiddlewares]],
// OPTIONAL, object.
// Using customized storage engine.
// `storage` should Should be compatible with the `Map` interface:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
storage: {
provider: [[POSTGRESQL || MARIADB || MYSQL || REDIS]],
get: async (key) => { /* Return session object by chatId. */ },
set: async (key, session) => { /* Save session object by chatId. */ },
client: { /* Customized database client / pool. */ },
query: async (topic) => { /* Search history and session by topic. */ },
upsert: async (event) => { /* Save event for history and session. */ },
},
},
// OPTIONAL, function.
// Using customized embedding engine for history and session search.
embedding: async (text) => { /* Return vector embedding of the text. */ },
// OPTIONAL, array of string.
// Supported mime types of your vision-enabled AI models.
// If omitted, bot will use standard OCR and Object Detect to handle images.
supportedMimeTypes: [...[[mimeTypes]]],
// OPTIONAL, object.
// Adding extra commands.
cmds: {
[[commandA]]: [[descriptionA]],
[[commandB]]: [[descriptionB]],
...[[OTHER COMMANDS]],
},
// OPTIONAL, object.
// Adding extra configurations
args: {
[[argA]]: {
type: 'string',
short: [[shortCut]],
default: [[defaultValue]],
desc: [[description]],
},
[[argB]]: {
type: 'binary',
short: [[shortCut]],
default: [[defaultValue]],
desc: [[description]],
},
...[[OTHER ARGS]],
},
};
await halbot(config);
For $10/month
, you can access the official halbot
service for a month.
You don't need to pay $20/month
for ChatGPT tokens separately.
halbot
is stable. It's running on top of the latest GPT-4
model. It has a better user experience than the official web app. You can access halbot
from your favourite Telegram apps on your phone, tablet and computer.
Additionally, halbot
has a lot of built-in input parsers to maximize the ChatGPT engine's power.
halbot
can now parse webpages, YouTube videos, PDFs, images, Office documents, code files, and text files. And other parsers are coming soon.
halbot
integrates Text-to-Image service by DALL·E 3. You can ask it to draw what you want.
halbot
also supports Text-to-Speech and Speech-to-Text. You can talk
to the AI engines to get help with your job.
And remember, you can always use the codes in this repo to build your own halbot
instant. This project will keep open source forever.
-
halbot
uses my other project 🧰 utilitas as the basic framework to handle all the dirty work. -
halbot
uses 🤖 utilitas.alan to communicate with the AI engines.
For Tasks:
Click tags to check more tools for each tasksFor Jobs:
Alternative AI tools for halbot
Similar Open Source Tools
halbot
halbot is a Telegram bot that uses ChatGPT, Gemini, Mistral, and other AI engines to provide a variety of services, including text generation, translation, summarization, and question answering. It is easy to use and extend, and it can be integrated into your own projects. halbot is open source and free to use.
langchain-swift
LangChain for Swift. Optimized for iOS, macOS, watchOS (part) and visionOS.(beta) This is a pure client library, no server required
Awesome-Quantization-Papers
This repo contains a comprehensive paper list of **Model Quantization** for efficient deep learning on AI conferences/journals/arXiv. As a highlight, we categorize the papers in terms of model structures and application scenarios, and label the quantization methods with keywords.
json-repair
JSON Repair is a toolkit designed to address JSON anomalies that can arise from Large Language Models (LLMs). It offers a comprehensive solution for repairing JSON strings, ensuring accuracy and reliability in your data processing. With its user-friendly interface and extensive capabilities, JSON Repair empowers developers to seamlessly integrate JSON repair into their workflows.
langcorn
LangCorn is an API server that enables you to serve LangChain models and pipelines with ease, leveraging the power of FastAPI for a robust and efficient experience. It offers features such as easy deployment of LangChain models and pipelines, ready-to-use authentication functionality, high-performance FastAPI framework for serving requests, scalability and robustness for language processing applications, support for custom pipelines and processing, well-documented RESTful API endpoints, and asynchronous processing for faster response times.
hCaptcha-Solver
hCaptcha-Solver is an AI-based hcaptcha text challenge solver that utilizes the playwright module to generate the hsw N data. It can solve any text challenge without any problem, but may be flagged on some websites like Discord. The tool requires proxies since hCaptcha also rate limits. Users can run the 'hsw_api.py' before running anything and then integrate the usage shown in 'main.py' into their projects that require hCaptcha solving. Please note that this tool only works on sites that support hCaptcha text challenge.
chatgpt-exporter
A script to export the chat history of ChatGPT. Supports exporting to text, HTML, Markdown, PNG, and JSON formats. Also allows for exporting multiple conversations at once.
mergoo
Mergoo is a library for easily merging multiple LLM experts and efficiently training the merged LLM. With Mergoo, you can efficiently integrate the knowledge of different generic or domain-based LLM experts. Mergoo supports several merging methods, including Mixture-of-Experts, Mixture-of-Adapters, and Layer-wise merging. It also supports various base models, including LLaMa, Mistral, and BERT, and trainers, including Hugging Face Trainer, SFTrainer, and PEFT. Mergoo provides flexible merging for each layer and supports training choices such as only routing MoE layers or fully fine-tuning the merged LLM.
ai00_server
AI00 RWKV Server is an inference API server for the RWKV language model based upon the web-rwkv inference engine. It supports VULKAN parallel and concurrent batched inference and can run on all GPUs that support VULKAN. No need for Nvidia cards!!! AMD cards and even integrated graphics can be accelerated!!! No need for bulky pytorch, CUDA and other runtime environments, it's compact and ready to use out of the box! Compatible with OpenAI's ChatGPT API interface. 100% open source and commercially usable, under the MIT license. If you are looking for a fast, efficient, and easy-to-use LLM API server, then AI00 RWKV Server is your best choice. It can be used for various tasks, including chatbots, text generation, translation, and Q&A.
agentic_security
Agentic Security is an open-source vulnerability scanner designed for safety scanning, offering customizable rule sets and agent-based attacks. It provides comprehensive fuzzing for any LLMs, LLM API integration, and stress testing with a wide range of fuzzing and attack techniques. The tool is not a foolproof solution but aims to enhance security measures against potential threats. It offers installation via pip and supports quick start commands for easy setup. Users can utilize the tool for LLM integration, adding custom datasets, running CI checks, extending dataset collections, and dynamic datasets with mutations. The tool also includes a probe endpoint for integration testing. The roadmap includes expanding dataset variety, introducing new attack vectors, developing an attacker LLM, and integrating OWASP Top 10 classification.
openlrc
Open-Lyrics is a Python library that transcribes voice files using faster-whisper and translates/polishes the resulting text into `.lrc` files in the desired language using LLM, e.g. OpenAI-GPT, Anthropic-Claude. It offers well preprocessed audio to reduce hallucination and context-aware translation to improve translation quality. Users can install the library from PyPI or GitHub and follow the installation steps to set up the environment. The tool supports GUI usage and provides Python code examples for transcription and translation tasks. It also includes features like utilizing context and glossary for translation enhancement, pricing information for different models, and a list of todo tasks for future improvements.
KG-LLM-Papers
KG-LLM-Papers is a repository that collects papers integrating knowledge graphs (KGs) and large language models (LLMs). It serves as a comprehensive resource for research on the role of KGs in the era of LLMs, covering surveys, methods, and resources related to this integration.
llama.rn
React Native binding of llama.cpp, which is an inference of LLaMA model in pure C/C++. This tool allows you to use the LLaMA model in your React Native applications for various tasks such as text completion, tokenization, detokenization, and embedding. It provides a convenient interface to interact with the LLaMA model and supports features like grammar sampling and mocking for testing purposes.
functionary
Functionary is a language model that interprets and executes functions/plugins. It determines when to execute functions, whether in parallel or serially, and understands their outputs. Function definitions are given as JSON Schema Objects, similar to OpenAI GPT function calls. It offers documentation and examples on functionary.meetkai.com. The newest model, meetkai/functionary-medium-v3.1, is ranked 2nd in the Berkeley Function-Calling Leaderboard. Functionary supports models with different context lengths and capabilities for function calling and code interpretation. It also provides grammar sampling for accurate function and parameter names. Users can deploy Functionary models serverlessly using Modal.com.
llmproxy
llmproxy is a reverse proxy for LLM API based on Cloudflare Worker, supporting platforms like OpenAI, Gemini, and Groq. The interface is compatible with the OpenAI API specification and can be directly accessed using the OpenAI SDK. It provides a convenient way to interact with various AI platforms through a unified API endpoint, enabling seamless integration and usage in different applications.
VoAPI
VoAPI is a new high-value/high-performance AI model interface management and distribution system. It is a closed-source tool for personal learning use only, not for commercial purposes. Users must comply with upstream AI model service providers and legal regulations. The system offers a visually appealing interface with features such as independent development documentation page support, service monitoring page configuration support, and third-party login support. Users can manage user registration time, optimize interface elements, and support features like online recharge, model pricing display, and sensitive word filtering. VoAPI also provides support for various AI models and platforms, with the ability to configure homepage templates, model information, and manufacturer information.
For similar tasks
LLMStack
LLMStack is a no-code platform for building generative AI agents, workflows, and chatbots. It allows users to connect their own data, internal tools, and GPT-powered models without any coding experience. LLMStack can be deployed to the cloud or on-premise and can be accessed via HTTP API or triggered from Slack or Discord.
ai-guide
This guide is dedicated to Large Language Models (LLMs) that you can run on your home computer. It assumes your PC is a lower-end, non-gaming setup.
onnxruntime-genai
ONNX Runtime Generative AI is a library that provides the generative AI loop for ONNX models, including inference with ONNX Runtime, logits processing, search and sampling, and KV cache management. Users can call a high level `generate()` method, or run each iteration of the model in a loop. It supports greedy/beam search and TopP, TopK sampling to generate token sequences, has built in logits processing like repetition penalties, and allows for easy custom scoring.
jupyter-ai
Jupyter AI connects generative AI with Jupyter notebooks. It provides a user-friendly and powerful way to explore generative AI models in notebooks and improve your productivity in JupyterLab and the Jupyter Notebook. Specifically, Jupyter AI offers: * An `%%ai` magic that turns the Jupyter notebook into a reproducible generative AI playground. This works anywhere the IPython kernel runs (JupyterLab, Jupyter Notebook, Google Colab, Kaggle, VSCode, etc.). * A native chat UI in JupyterLab that enables you to work with generative AI as a conversational assistant. * Support for a wide range of generative model providers, including AI21, Anthropic, AWS, Cohere, Gemini, Hugging Face, NVIDIA, and OpenAI. * Local model support through GPT4All, enabling use of generative AI models on consumer grade machines with ease and privacy.
khoj
Khoj is an open-source, personal AI assistant that extends your capabilities by creating always-available AI agents. You can share your notes and documents to extend your digital brain, and your AI agents have access to the internet, allowing you to incorporate real-time information. Khoj is accessible on Desktop, Emacs, Obsidian, Web, and Whatsapp, and you can share PDF, markdown, org-mode, notion files, and GitHub repositories. You'll get fast, accurate semantic search on top of your docs, and your agents can create deeply personal images and understand your speech. Khoj is self-hostable and always will be.
langchain_dart
LangChain.dart is a Dart port of the popular LangChain Python framework created by Harrison Chase. LangChain provides a set of ready-to-use components for working with language models and a standard interface for chaining them together to formulate more advanced use cases (e.g. chatbots, Q&A with RAG, agents, summarization, extraction, etc.). The components can be grouped into a few core modules: * **Model I/O:** LangChain offers a unified API for interacting with various LLM providers (e.g. OpenAI, Google, Mistral, Ollama, etc.), allowing developers to switch between them with ease. Additionally, it provides tools for managing model inputs (prompt templates and example selectors) and parsing the resulting model outputs (output parsers). * **Retrieval:** assists in loading user data (via document loaders), transforming it (with text splitters), extracting its meaning (using embedding models), storing (in vector stores) and retrieving it (through retrievers) so that it can be used to ground the model's responses (i.e. Retrieval-Augmented Generation or RAG). * **Agents:** "bots" that leverage LLMs to make informed decisions about which available tools (such as web search, calculators, database lookup, etc.) to use to accomplish the designated task. The different components can be composed together using the LangChain Expression Language (LCEL).
danswer
Danswer is an open-source Gen-AI Chat and Unified Search tool that connects to your company's docs, apps, and people. It provides a Chat interface and plugs into any LLM of your choice. Danswer can be deployed anywhere and for any scale - on a laptop, on-premise, or to cloud. Since you own the deployment, your user data and chats are fully in your own control. Danswer is MIT licensed and designed to be modular and easily extensible. The system also comes fully ready for production usage with user authentication, role management (admin/basic users), chat persistence, and a UI for configuring Personas (AI Assistants) and their Prompts. Danswer also serves as a Unified Search across all common workplace tools such as Slack, Google Drive, Confluence, etc. By combining LLMs and team specific knowledge, Danswer becomes a subject matter expert for the team. Imagine ChatGPT if it had access to your team's unique knowledge! It enables questions such as "A customer wants feature X, is this already supported?" or "Where's the pull request for feature Y?"
infinity
Infinity is an AI-native database designed for LLM applications, providing incredibly fast full-text and vector search capabilities. It supports a wide range of data types, including vectors, full-text, and structured data, and offers a fused search feature that combines multiple embeddings and full text. Infinity is easy to use, with an intuitive Python API and a single-binary architecture that simplifies deployment. It achieves high performance, with 0.1 milliseconds query latency on million-scale vector datasets and up to 15K QPS.
For similar jobs
weave
Weave is a toolkit for developing Generative AI applications, built by Weights & Biases. With Weave, you can log and debug language model inputs, outputs, and traces; build rigorous, apples-to-apples evaluations for language model use cases; and organize all the information generated across the LLM workflow, from experimentation to evaluations to production. Weave aims to bring rigor, best-practices, and composability to the inherently experimental process of developing Generative AI software, without introducing cognitive overhead.
LLMStack
LLMStack is a no-code platform for building generative AI agents, workflows, and chatbots. It allows users to connect their own data, internal tools, and GPT-powered models without any coding experience. LLMStack can be deployed to the cloud or on-premise and can be accessed via HTTP API or triggered from Slack or Discord.
VisionCraft
The VisionCraft API is a free API for using over 100 different AI models. From images to sound.
kaito
Kaito is an operator that automates the AI/ML inference model deployment in a Kubernetes cluster. It manages large model files using container images, avoids tuning deployment parameters to fit GPU hardware by providing preset configurations, auto-provisions GPU nodes based on model requirements, and hosts large model images in the public Microsoft Container Registry (MCR) if the license allows. Using Kaito, the workflow of onboarding large AI inference models in Kubernetes is largely simplified.
PyRIT
PyRIT is an open access automation framework designed to empower security professionals and ML engineers to red team foundation models and their applications. It automates AI Red Teaming tasks to allow operators to focus on more complicated and time-consuming tasks and can also identify security harms such as misuse (e.g., malware generation, jailbreaking), and privacy harms (e.g., identity theft). The goal is to allow researchers to have a baseline of how well their model and entire inference pipeline is doing against different harm categories and to be able to compare that baseline to future iterations of their model. This allows them to have empirical data on how well their model is doing today, and detect any degradation of performance based on future improvements.
tabby
Tabby is a self-hosted AI coding assistant, offering an open-source and on-premises alternative to GitHub Copilot. It boasts several key features: * Self-contained, with no need for a DBMS or cloud service. * OpenAPI interface, easy to integrate with existing infrastructure (e.g Cloud IDE). * Supports consumer-grade GPUs.
spear
SPEAR (Simulator for Photorealistic Embodied AI Research) is a powerful tool for training embodied agents. It features 300 unique virtual indoor environments with 2,566 unique rooms and 17,234 unique objects that can be manipulated individually. Each environment is designed by a professional artist and features detailed geometry, photorealistic materials, and a unique floor plan and object layout. SPEAR is implemented as Unreal Engine assets and provides an OpenAI Gym interface for interacting with the environments via Python.
Magick
Magick is a groundbreaking visual AIDE (Artificial Intelligence Development Environment) for no-code data pipelines and multimodal agents. Magick can connect to other services and comes with nodes and templates well-suited for intelligent agents, chatbots, complex reasoning systems and realistic characters.