modelmerge is a multi-large language model API aggregator.
Project description
modelmerge
modelmerge is a powerful library designed to simplify and unify the use of different large language models, including GPT-3.5/4/4 Turbo/4o, o1-preview/o1-mini, DALL-E 3, Claude2/3/3.5, Gemini1.5 Pro/Flash, Vertex AI (Claude, Gemini), DuckDuckGo, and Groq. The library supports GPT format function calls and has built-in Google search and URL summarization features, greatly enhancing the practicality and flexibility of the models.
✨ Features
- Multi-model support: Integrate various latest large language models.
- Real-time Interaction: Supports real-time query streams, real-time model response retrieval.
- Function Expansion: With built-in function calling support, the model's functions can be easily expanded, currently supporting plugins such as DuckDuckGo and Google search, content summarization, Dalle-3 drawing, arXiv paper summaries, current time, code interpreter, and more.
- Simple Interface: Provides a concise and unified API interface, making it easy to call and manage the model.
Quick Start
The following is a guide on how to quickly integrate and use modelmerge in your Python project.
Install
First, you need to install modelmerge. It can be installed directly via pip:
pip install modelmerge
Usage example
The following is a simple example demonstrating how to use modelmerge to request the GPT-4 model and handle the returned streaming data:
from ModelMerge import chatgpt
# Initialize the model, set the API key and the selected model
bot = chatgpt(api_key="{YOUR_API_KEY}", engine="gpt-4o")
# Get response
result = bot.ask("python list use")
# Send request and get streaming response in real-time
for text in bot.ask_stream("python list use"):
print(text, end="")
# Disable all plugins
bot = chatgpt(api_key="{YOUR_API_KEY}", engine="gpt-4o", use_plugins=False)
🍃 Environment Variables
The following is a list of environment variables related to plugin settings:
Variable Name | Description | Required? |
---|---|---|
get_search_results | Enable search plugin. Default value is False . |
No |
get_url_content | Enable URL summary plugin. The default value is False . |
No |
download_read_arxiv_pdf | Whether to enable the arXiv paper abstract plugin. The default value is False . |
No |
run_python_script | Whether to enable the code interpreter plugin. The default value is False . |
No |
generate_image | Whether to enable the image generation plugin. The default value is False . |
No |
get_date_time_weekday | Whether to enable the date plugin. The default value is False . |
No |
Supported models
- GPT-3.5/4/4 Turbo/4o
- o1-preview/o1-mini
- DALL-E 3
- Claude2/3/3.5
- Gemini1.5 Pro/Flash
- Vertex AI (Claude, Gemini)
- Groq
- DuckDuckGo(gpt-4o-mini, claude-3-haiku, Meta-Llama-3.1-70B, Mixtral-8x7B)
🧩 Plugin
This project supports multiple plugins, including: DuckDuckGo and Google search, URL summary, ArXiv paper summary, DALLE-3 drawing, and code interpreter, etc. You can enable or disable these plugins by setting environment variables.
- How to develop a plugin?
The plugin-related code is all in the ModelMerge git submodule of this repository. ModelMerge is an independent repository I developed for handling API requests, conversation history management, and other functionality. When you clone this repository with the --recurse-submodules
parameter, ModelMerge will be automatically downloaded. All plugin code is located in the relative path ModelMerge/src/ModelMerge/plugins
in this repository. You can add your own plugin code in this directory. The plugin development process is as follows:
- Create a new Python file in the
ModelMerge/src/ModelMerge/plugins
directory, for example,myplugin.py
. Register the plugin by adding the@register_tool()
decorator above the function. Importregister_tool
withfrom .registry import register_tool
.
After completing the above steps, your plugin is ready to use. 🎉
License
This project is licensed under the MIT License.
Contribution
Welcome to contribute improvements by submitting issues or pull requests through GitHub.
Contact Information
If you have any questions or need assistance, please contact us at yym68686@outlook.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file modelmerge-1.0.29.tar.gz
.
File metadata
- Download URL: modelmerge-1.0.29.tar.gz
- Upload date:
- Size: 83.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e8ef3e0dd8a5b84dfcc38a9045e47abc7c23b0f5259625ec25754b7febb4fdb8
|
|
MD5 |
68c80e5e4627dbbc923bd8c2fc5ad63d
|
|
BLAKE2b-256 |
bc4b3af6d495311b91cdb788ba35287c461ceb2dbf774c96d9c49dd2db61cd99
|
File details
Details for the file modelmerge-1.0.29-py3-none-any.whl
.
File metadata
- Download URL: modelmerge-1.0.29-py3-none-any.whl
- Upload date:
- Size: 78.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
2c5f83c8ed9485acfe17537f41fb6321f27d06548263f6fd58a1100f97a5134f
|
|
MD5 |
d36dffed1e5d4ad4eb9cda791a936c43
|
|
BLAKE2b-256 |
7cbde8e2e1fb8cb669090a8f539e4ba8f0cb9a54d304a3d6fa02338d1733c768
|