Set tool annotations by decorating the tool function, not in `chat.register_tool()`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず chat.register_tool() の実装と既存のツールアノテーション処理を読み、次に issue #169 の関連する懸念事項を確認してください。アノテーションをデコレーターでツール関数に宣言でき、register_tool() がアノテーションを別途指定せずにデコレートされた関数を使用できるようになれば、変更は完了です。
索引モデルが issue の本文から書いたものです。
説明
Tool annotations should be attached to the tool definition as closely as possible. It's currently awkward to create to a tool function that has annotations because those annotations need to be passed to chat.register_tool() at registration, which might be in a different place than where the tool is defined. (The tool could be in packaged code and the registration in user code.)
Instead of this
import faicons
from chatlas import ChatOpenAI
def get_weather_forecast(
lat: float, lon: float, location_name: str
) -> ContentToolResult:
"""Get the weather forecast for a location."""
# Mocked weather data for demonstration purposes
return {"temperature_2m": 18, "condition": "Partly Cloudy"}
# Create chat client and register tool
chat_client = ChatOpenAI(model="gpt-4.1-nano")
chat_client.register_tool(
get_weather_forecast,
annotations={ # << THIS COULD HAPPEN FAR FROM TOOL DEL
"title": "Weather Forecast",
"icon": faicons.icon_svg("cloud"),
},
)
Maybe this
import faicons
from chatlas import ChatOpenAI, add_tool_annotations
@add_tool_annotations(
title="Weather Forecast",
icon=faicons.icon_svg("cloud")
)
def get_weather_forecast(
lat: float, lon: float, location_name: str
) -> ContentToolResult:
"""Get the weather forecast for a location."""
# Mocked weather data for demonstration purposes
return {"temperature_2m": 18, "condition": "Partly Cloudy"}
# Create chat client and register tool
chat_client = ChatOpenAI(model="gpt-4.1-nano")
chat_client.register_tool(get_weather_forecast)
Advantages
This would also resolve some of the underlying issue in #169 where known standard MCP Tool Annotation properties could be named arguments that are documented, but additional kwargs are just added as tool annotations.
- 主要言語
- Python
- スター
- 179
- フォーク
- 32
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
posit-dev/chatlas のほかの issue
-
A streaming text delta that repeats everything streamed so far is missing from the recorded turn対応中かも @cpsievert が 81 日前に担当しました。 オープンai-triage:done Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
ai-triage:needs-review documentation
難易度 2/5 1〜2日 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
ai-triage:done Priority: Low
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
posit-dev/chatlas の issue をすべて見る
似ている issue
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
country:US rating:6 request-theme type:TV SHOW
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
LizardByte/ThemerrDB#10501 · コメント 1 件 ·
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
agentscope-ai/agentscope#4563 ·
メンテナーはふだん 2 日以内に返信
-
comp/desktop desktop/chat P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
NousResearch/hermes-agent#164451 ·
メンテナーはふだん 1 日以内に返信
-
external integration integration-submission
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
langchain-ai/docs#8426 ·
メンテナーはふだん 1 日以内に返信