simonw/llm-meta-ai

GitHub: simonw/llm-meta-ai

为 LLM 命令行工具提供 Meta AI API 接入能力的插件,支持推理控制、多模态附件、工具调用和结构化输出。

Stars: 1 | Forks: 0

# llm-meta-ai [![PyPI](https://img.shields.io/pypi/v/llm-meta-ai.svg)](https://pypi.org/project/llm-meta-ai/) [![测试](https://static.pigsec.cn/wp-content/uploads/repos/cas/ce/ce733292a922c08274cf5a2096f8fa4cf01023bfa51a36ef6beecaaef371a9d9.svg)](https://github.com/simonw/llm-meta-ai/actions/workflows/test.yml) [![更新日志](https://img.shields.io/github/v/release/simonw/llm-meta-ai?include_prereleases&label=changelog)](https://github.com/simonw/llm-meta-ai/releases) [![许可证](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-meta-ai/blob/main/LICENSE) [LLM](https://llm.datasette.io/) 插件,用于 [Meta AI API](https://developer.meta.com/ai/) 托管的模型 ## 安装说明 在与 LLM 相同的环境中安装此插件: ``` llm install llm-meta-ai ``` ## 用法 首先,获取 Meta AI API 的密钥,并将其设置为名为 `meta-ai` 的密钥: ``` llm keys set meta-ai # 在此处粘贴 key ``` 你也可以使用 `META_AI_TOKEN` 环境变量来设置密钥。 运行 `llm models` 以获取可用模型的完整列表。模型以 `meta-ai/` 为前缀,例如: ``` llm -m meta-ai/muse-spark-1.1 "What is the capital of France?" ``` 你也可以像这样仅列出 Meta AI 模型: ``` llm meta-ai models ``` 添加 `--json` 以获取完整的 JSON 模型定义。 模型列表从 API 获取并缓存一小时。运行以下命令以刷新它: ``` llm meta-ai refresh ``` ### 推理 这些是推理模型:它们在回答之前会进行思考,并且推理 token 会计入你的输出 token 预算 —— 它们会在 `llm logs --json` 的 `completion_tokens_details.reasoning_tokens` 键中报告。使用 `reasoning_effort` 选项控制模型的推理程度,可选值包括 `none`、`minimal`、`low`、`medium`、`high` 或 `xhigh`(并非每个模型都支持所有取值): ``` llm -m meta-ai/muse-spark-1.1 'What is the capital of France?' -o reasoning_effort low ``` ### 速率限制与 max_tokens 请求在运行*之前*就会受到输出 token 速率限制。在 prompt 上设置 token 限制有助于避免耗尽配用额度 —— 请为推理 token 留出充足的余量: ``` llm -m meta-ai/muse-spark-1.1 'A short poem about a pelican' -o max_tokens 2000 ``` 速率限制是按模型应用的 —— 如果某个模型即使在长时间等待后仍然返回 429 错误,则它可能未对你的团队启用,即使它出现在模型列表中。 ### 附件 模型接受图像(PNG、JPEG、WebP、GIF、ICO)和 PDF: ``` llm -m meta-ai/muse-spark-1.1 'Describe this image' \ -a https://static.simonwillison.net/static/2024/pelicans.jpg ``` 该 API 还通过其 Files API 支持 MP4 视频,但此插件目前尚未使用该功能。 ### 工具 Meta AI 模型支持 [tools](https://llm.datasette.io/en/stable/tools.html): ``` llm -m meta-ai/muse-spark-1.1 -T llm_time 'What time is it?' --td ``` ### Schemas 它们也支持 [schemas](https://llm.datasette.io/en/stable/schemas.html): ``` llm -m meta-ai/muse-spark-1.1 'Invent a dog' --schema 'name, age int, breed' ``` ## 开发说明 要为此库做出贡献,请首先检出代码。然后创建一个新的虚拟环境: ``` cd llm-meta-ai python -m venv venv source venv/bin/activate ``` 现在安装依赖项和测试依赖项: ``` python -m pip install -e . --group dev ``` 要运行测试: ``` python -m pytest ```
标签:API插件, DLL 劫持, Meta AI, Python, SOC Prime, 人工智能, 大语言模型, 开发工具, 无后门, 用户模式Hook绕过, 逆向工具