调用 OpenAI 等模型需自备 API Key;playground 需先 git clone 仓库再 streamlit run,且托管版不支持 LlamaCpp;默认会向 Sentry 上报错误数据,需设 SENTRY_OPT_OUT 环境变量关闭
prompttools
hegelaiApache-2.0更新放缓一套用来测试和实验提示词的开源工具,支持 OpenAI、LLaMA 等大模型以及 Chroma、Weaviate 等向量数据库,方便对比不同提示词的效果。
Open-source tools for prompt testing and experimentation, with support for both LLMs (e.g. OpenAI, LLaMA) and vector databases (e.g. Chroma, Weaviate, LanceDB).
pip install prompttoolsREADME 未说明显存或 GPU 要求;LLaMA.Cpp 等本地模型推理需自备算力,云端 API 模型则无特殊硬件要求
自托管的提示词、LLM 与向量数据库测试实验工具,几行代码就能跨模型跑对比
一套用来测试和实验提示词的开源工具,支持 OpenAI、LLaMA 等大模型以及 Chroma、Weaviate 等向量数据库,方便对比不同提示词的效果。
核心能力
- 用 Experiment 类批量跑多模型多参数组合
- 支持 OpenAI、Anthropic、LLaMA.Cpp、Gemini 等模型
- 可评估 Chroma、Weaviate、Qdrant 等向量库检索效果
- 结果可 visualize 可视化,并导出 CSV/JSON/MongoDB
- 提供本地 Streamlit playground 交互界面
容易踩的坑
- v0.0.45prompttools 0.0.45 - Introducing Observability features!最新正式版2024-01-02 · 2024-01-02 06:57 UTC
Launch of PromptTools Observability (Private Beta)
We're excited to announce the addition of observability features on our hosted platform. It allows your teams to monitor and evaluate your production usages of LLMs with just one line of code change!
import prompttools.loggerThe new features are integrated with our open-source library as well as the PromptTools playground. Our goal is to enable reliable deployments of LLM usages more quickly and observes any issues in real-time.
If you are interested to try out platform, please reach out to us.
We remain committed to expanding this open source library. We look forward to build more development tools that enable you to iterate faster with AI models. Please have a look at our open issues to what features are coming.
Major Features Updates
OpenAI API Updates
- We have updated various experiments and examples to use OpenAI's latest features and Python API
- Make sure you are using
openaiversion 1.0+
Moderation API
- We have integrated with OpenAI's moderation API as an eval function
- This allows you to check if your experiments' responses (from any LLMs) violate content moderation policy (such as violence, harassment).
Hosted APIs
- Production logging API
- Contact us if you would like to get started with our hosted observability features!
Community
If you have suggestions on the API or use cases you'd like to be covered, please open a GitHub issue. We'd love to hear thoughts and feedback. As always, we welcome new contributors to our repo and we have a few good first issues to get you started.
Full Changelog: https://github.com/hegelai/prompttools/compare/v0.0.41...v0.0.45
- v0.0.41prompttools 0.0.41 - Hosted Playground Launch2023-11-04 · 2023-11-04 00:45 UTC
查看更新说明
Launch of PromptTools Playground (Private Beta)
We're excited to announce the private beta of PromptTools Playground! It is a hosted platform integrated with our open-source library. It persists your experiments with version control and provides collaboration features suited for teams.
If you are interested to try out platform, please reach out to us. We remain committed to expanding this open source library. We look forward to build more development tools that enable you to iterate faster with AI models.
Major Features Updates
New Harnesses
- ChatPromptTemplateExperimentationHarness
- ModelComparisonHarness
Experimental APIs
run_oneandrun_partialfor `OpenAIChatExperiment- You no longer have to re-run the entire experiment! You can now partial execute parameters that you care about.
Hosted APIs
- Save, load, and share your experiments through our hosted playground
save_experimentload_experiment
Community
If you have suggestions on the API or use cases you'd like to be covered, please open a GitHub issue. We'd love to hear thoughts and feedback. As always, we welcome new contributors to our repo and we have a few good first issues to get you started.
- v0.0.35prompttools 0.0.352023-10-03 · 2023-10-03 22:15 UTC
查看更新说明
Major Features Updates
New APIs
- Google Vertex AI
- Azure OpenAI Service
- Replicate
- Stable Diffusion
- Pinecone
- Qdrant
- Retrieval-Augmented Generation (RAG)
Utility Functions
chunk_textautoeval_with_documentsstructural_similarity
Community
Shout out to @HashemAlsaket, @bweber-rebellion, @imalsky, @kacperlukawski for actively participating and contributing new features!
If you have suggestions on the API or use cases you'd like to be covered, please open a GitHub issue. We'd love to hear thoughts and feedback. As always, we welcome new contributors to our repo and we have a few good first issues to get you started.
If you are interested in a hosted version of
prompttoolswith more features for your team, please reach out. - v0.0.33prompttools 0.0.332023-08-17 · 2023-08-17 07:05 UTC
查看更新说明
Major Features Updates
New APIs
OpenAIChatExperiment- it can now call functions.- LangChain Sequential Chain
- LangChain Router Chain
- LanceDB
- Initial support for benchmarking (with HellaSwag)
Other Improvements
There are also many fixes and improvements we made to different experiments. Notably, we refactored how
evaluateworks. In this version, the evaluation function being passed intoexperiment.evaluate()should handle a row of data plus other optional keyword arguments. Please see our updated example notebooks as references.Playground
The playground now supports shareable links. You can use the
Sharebutton to create a link and share your experiment setup with your teammates.Community
Shout out to @HashemAlsaket, @AyushExel, @pramitbhatia25 @mmmaia actively participating and contributing new features!
If you have suggestions on the API or use cases you'd like to be covered, please open a GitHub issue. We'd love to hear thoughts and feedback. As always, we welcome new contributors to our repo and we have a few good first issues to get you started.
- v0.0.22prompttools 0.0.222023-08-01 · 2023-08-01 17:43 UTC
查看更新说明
Major features added recently:
New APIs:
- Anthropic Claude
- Google PaLM
- Chroma
- Weaviate
- MindsDB
Playground
If you would like to execute your experiments in a StreamLit UI rather than in a notebook, you can do that with:
pip install prompttools git clone https://github.com/hegelai/prompttools.git cd prompttools && streamlit run prompttools/playground/playground.pyCommunity
Shout out to @HashemAlsaket actively participating and contributing new features!
If you have suggestions on the API or use cases you'd like to be covered, please open a GitHub issue. We'd love to hear thoughts and feedback. As always, we welcome new contributors to our repo and we have a few good first issues to get you started.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Welcome to prompttools created by Hegel AI! This repo offers a set of open-source, self-hostable tools for experimenting with, testing, and evaluating LLMs, vector databases, and prompts. The core idea is to enable developers to evaluate using familiar interfaces like code, notebooks, and a local playground.
In just a few lines of code, you can test your prompts and parameters across different models (whether you are using OpenAI, Anthropic, or LLaMA models). You can even evaluate the retrieval accuracy of vector databases.
from prompttools.experiment import OpenAIChatExperiment
messages = [
[{"role": "user", "content": "Tell me a joke."},],
[{"role": "user", "content": "Is 17077 a prime number?"},],
]
models = ["gpt-3.5-turbo", "gpt-4"]
temperatures = [0.0]
openai_experiment = OpenAIChatExperiment(models, messages, temperature=temperatures)
openai_experiment.run()
openai_experiment.visualize()

To stay in touch with us about issues and future updates, join the Discord.
Quickstart
To install prompttools, you can use pip:
pip install prompttools
You can run a simple example of a prompttools locally with the following
git clone https://github.com/hegelai/prompttools.git
cd prompttools && jupyter notebook examples/notebooks/OpenAIChatExperiment.ipynb
You can also run the notebook in Google Colab
Playground
If you want to interact with prompttools using our playground interface, you can launch it with the following commands.
You can run a simple example of a prompttools locally with the following
pip install notebook # If jupyter notebook has not been installed
pip install prompttools
Then, clone the git repo and launch the streamlit app:
git clone https://github.com/hegelai/prompttools.git
cd prompttools && streamlit run prompttools/playground/playground.py
You can also access a hosted version of the playground on the Streamlit Community Cloud.
Note: The hosted version does not support LlamaCpp
Documentation
Our documentation website contains the full API reference and more description of individual components. Check it out!
Supported Integrations
Here is a list of APIs that we support with our experiments:
LLMs
- OpenAI (Completion, ChatCompletion, Fine-tuned models) - Supported
- LLaMA.Cpp (LLaMA 1, LLaMA 2) - Supported
- HuggingFace (Hub API, Inference Endpoints) - Supported
- Anthropic - Supported
- Mistral AI - Supported
- Google Gemini - Supported
- Google PaLM (legacy) - Supported
- Google Vertex AI - Supported
- Azure OpenAI Service - Supported
- Replicate - Supported
- Ollama - In Progress
Vector Databases and Data Utility
- Chroma - Supported
- Weaviate - Supported
- Qdrant - Supported
- LanceDB - Supported
- Milvus - Exploratory
- Pinecone - Supported
- Epsilla - In Progress
Frameworks
- LangChain - Supported
- MindsDB - Supported
- LlamaIndex - Exploratory
Computer Vision
- Stable Diffusion - Supported
- Replicate's hosted Stable Diffusion - Supported
If you have any API that you'd like to see being supported soon, please open an issue or a PR to add it. Feel free to discuss in our Discord channel as well.
Frequently Asked Questions (FAQs)
-
Will this library forward my LLM calls to a server before sending it to OpenAI, Anthropic, and etc.?
- No, the source code will be executed on your machine. Any call to LLM APIs will be directly executed from your machine without any forwarding.
-
Does
prompttoolsstore my API keys or LLM inputs and outputs to a server?- No, all of those data stay on your local machine. We do not collect any PII (personally identifiable information).
-
How do I persist my results?
- To persist the results of your tests and experiments, you can export your
Experimentwith the methodsto_csv,to_json,to_lora_json, orto_mongo_db. We are building more persistence features and we will be happy to further discuss your use cases, pain points, and what export options may be useful for you.
- To persist the results of your tests and experiments, you can export your
Sentry
Since we are changing our API rapidly, there are some errors caused by our negligence or out of date documentation. To improve user experience, we collect data from normal package usage that helps us understand the errors that are raised. This data is collected and sent to Sentry, a third-party error tracking service, commonly used in open-source softwares. It only logs this library's own actions.
You can easily opt-out by defining an environment variable called SENTRY_OPT_OUT.
Contributing
We welcome PRs and suggestions! Don't hesitate to open a PR/issue or to reach out to us via email. Please have a look at our contribution guide and "Help Wanted" issues to get started!
Usage and Feedback
We will be delighted to work with early adopters to shape our designs. Please reach out to us via email if you're interested in using this tooling for your project or have any feedback.
License
We will be gradually releasing more components to the open-source community. The current license can be found in the LICENSE file. If there is any concern, please contact us and we will be happy to work with you.