← 开源
microsoft

sammo

A library for prompt engineering and optimization (SAMMO = Structure-aware Multi-Objective Metaprompt Optimization)

AI EngineeringPrompt & ScaffoldPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
781
Star
53
Fork
+1
本周
4
贡献者
创建于 2023-12-04 · 更新于 2026-10-12 · 今日第 13885 名
主要开发者
t-schnpbourkesammym1982

microsoft/sammo 排名第 13,885,有 781 个星标。

同类别比较

microsoft/sammo 排名第 13,885,此处有 8 个同类条目;thunlp/OpenAttack 排名第 13,886。

同类别比较
名称排名指标
ZHO-ZHO-ZHO/ComfyUI-Gemini13,870
语言:
Python
星标数:
783
分叉数:
65
简介:
Using Gemini in ComfyUI
countbot-ai/CountBot13,877
语言:
Python
星标数:
782
分叉数:
104
简介:
更适配中文用户的轻量开源AI Agent | 国产大模型Coding plan支持 | 兼容OpenClaw Skills生态| 已接入微信ClawBot/微博龙虾/飞书/钉钉/QQ/小智AI/Telegram/deepseek-v4。
langchain-ai/auto-evaluator13,878
语言:
TypeScript
星标数:
782
分叉数:
101
plasma-ai/fractal13,881
语言:
Python
星标数:
782
分叉数:
57
简介:
Hierarchical agent loops with recursive self-organization.
thunlp/OpenAttack13,886
语言:
Python
星标数:
781
分叉数:
127
简介:
An Open-Source Package for Textual Adversarial Attack.
OfficeDev/microsoft-365-agents-toolkit13,892
语言:
TypeScript
星标数:
780
分叉数:
316
简介:
Developer tools for building Teams apps
Prismer-AI/Prismer13,893
语言:
TypeScript
星标数:
780
分叉数:
38
简介:
Open Source Research Claw
allenai/visprog13,894
语言:
Python
星标数:
780
分叉数:
66
简介:
Official code for VisProg (CVPR 2023 Best Paper!)
关键参数与规格
关键参数与规格
参数值
语言Python
类别AI Engineering
子类别Prompt & Scaffold
关键词Prompt engineering
星标数781
分叉数53
贡献者4
创建日期2023-12-04
更新日期2026-10-12
1 天星标数0
7 天星标数1
排名13,885
上次排名13,772
排名变化-113
7 天星标排名10,703
上次 7 天星标排名10,761
7 天星标排名变化58
总星标排名13,610
上次总星标排名13,587
总星标排名变化-23
国家USA
README 摘录

SAMMO (📘User Guide) A flexible, easy-to-use library for running and optimizing prompts for Large Language Models (LLMs). 🎉 News Nov 13, 2024: Turn Markdown into prompt programs: First version of SAMMO express released Nov 1, 2024: Use CSS selectors to query and modify prompt programs! Oct 15, 2024: SAMMO now supports structured outputs! How to Get Started Go to the user guide for examples, how-tos, and API reference. Install library only Install and run tutorials ***Prerequisites*** Python 3

. 9+ The following commands will install sammo and jupyter and launch jupyter notebook. It's recommended that you create and activate a virtualenv prior to installing packages. Example This example shows how easy it is to optimize a prompt with SAMMO. Use Cases SAMMO is designed to support **Efficient data labeling**: Supports minibatching by packing and parsing multiple datapoints into a single prompt. **Prompt prototyping and engineering**: Re-usable components and prompt structures to quickly build and test new prompts. **Instruction

optimization**: Optimize instructions to do better on a given task. **Prompt compression**: Compress prompts while maintaining performance. **Large-scale prompt execution**: parallelization and rate-limiting out-of-the-box so you can run many queries in parallel and at scale without overwhelming the LLM API. It is less useful if you want to build Interactive, agent-based LLM applications (→ check out AutoGen) Interactive, production-ready LLM applications (→ check out LangChain) Licence This project is licensed under MIT. To cite this

paper, you can use the following BibTeX entry: Authors was written by Tobias Schnabel. Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e. Simply follow the instructions

provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft. com with any additional questions or comments.

常见问题

记录了多少星标和分叉?

microsoft/sammo 有 781 个星标和 53 个分叉。

仓库排名是多少?

microsoft/sammo 排名第 13,885。

记录的语言和类别是什么?

microsoft/sammo 有 781 个星标,语言为 Python,类别为 AI Engineering。

哪个仓库排名最接近?

microsoft/sammo 与 thunlp/OpenAttack 比较,后者排名第 13,886,有 781 个星标。

README

SAMMO (📘User Guide)

A flexible, easy-to-use library for running and optimizing prompts for Large Language Models (LLMs).

🎉 News

  • Nov 13, 2024: Turn Markdown into prompt programs: First version of SAMMO express released
  • Nov 1, 2024: Use CSS selectors to query and modify prompt programs!
  • Oct 15, 2024: SAMMO now supports structured outputs!

How to Get Started

Go to the user guide for examples, how-tos, and API reference.

Just want to have a quick look? Try the live demo on Binder.

Install library only

pip install sammo

Install and run tutorials

Prerequisites

  • Python 3.9+

The following commands will install sammo and jupyter and launch jupyter notebook. It's recommended that you create and activate a virtualenv prior to installing packages.

pip install sammo jupyter

# clone sammo to a local directory
git clone https://github.com/microsoft/sammo.git
cd sammo

# launch jupyter notebook and open tutorials directory
jupyter notebook --notebook-dir docs/tutorials

Example

This example shows how easy it is to optimize a prompt with SAMMO. The full example is in the user guide.

runner = OpenAIChat(model_id="gpt-3.5-turbo", api_config=API_CONFIG)
PROMPT_IN_MARKDOWN = """
# Instructions 
Convert the following user queries into a SQL query.

# Table
Users:
- user_id (INTEGER, PRIMARY KEY)
- name (TEXT)
- age (INTEGER)
- city (TEXT)

# Complete this
Input: {{{input}}}
Output:
"""

spp = MarkdownParser(PROMPT_IN_MARKDOWN).get_sammo_program()
mutation_operators = BagOfMutators(
    Output(GenerateText(spp)),
    Paraphrase("#instr"),
    Rewrite("#instr", "Make this more verbose.\n\n {{{{text}}}}")
)
prompt_optimizer = BeamSearch(runner, mutation_operators, accuracy)
prompt_optimizer.fit(d_train)
prompt_optimizer.show_report()

Use Cases

SAMMO is designed to support

  • Efficient data labeling: Supports minibatching by packing and parsing multiple datapoints into a single prompt.
  • Prompt prototyping and engineering: Re-usable components and prompt structures to quickly build and test new prompts.
  • Instruction optimization: Optimize instructions to do better on a given task.
  • Prompt compression: Compress prompts while maintaining performance.
  • Large-scale prompt execution: parallelization and rate-limiting out-of-the-box so you can run many queries in parallel and at scale without overwhelming the LLM API.

It is less useful if you want to build

  • Interactive, agent-based LLM applications (→ check out AutoGen)
  • Interactive, production-ready LLM applications (→ check out LangChain)

Licence

This project is licensed under MIT.

To cite this paper, you can use the following BibTeX entry:

@inproceedings{schnabel-neville-2024-symbolic,
    title = "Symbolic Prompt Program Search: A Structure-Aware Approach to Efficient Compile-Time Prompt Optimization",
    author = "Schnabel, Tobias and Neville, Jennifer",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2024",
    year = "2024",
    url = "https://aclanthology.org/2024.findings-emnlp.37",
    pages = "670--686"
}

Authors

SAMMO was written by Tobias Schnabel.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit .

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

排名相邻
同类项目