Support caching of chat cogs
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Issue では、例で使用される Roast::Cogs::Chat#execute と Session、Output、config オブジェクトが挙げられています。まずそこから始め、chat-cog の入力と結果がどのように表現されているかを追跡してください。サポートされるキャッシュ入力と cog ごとの設定(セッションの動作を含む)を定義し、その後、ワークフローを繰り返し実行したときにチャットの結果を壊すことなく有効なレスポンスが再利用されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
While developing a new workflow it is common to have to re-run it multiple times for testing.
Chat cogs result in both higher costs and slower iteration.
I'm currently using this short monkeypatch which can serve as example, but a real implementation would need to support sessions (and maybe other parameters I haven't considered) and should ideally be configurable per chat cog, instead of globally:
require 'digest'
module CachedChat
def execute(input)
cache_dir = '/tmp/roast_chat_cache'
chat_digest = Digest::SHA256.hexdigest(input.valid_prompt!)
cache_key = "#{config.valid_provider!}:#{config.valid_model}:#{chat_digest}"
cache_file = File.join(cache_dir, "chat_#{cache_key}.txt")
if File.exist?(cache_file)
cached_response = File.read(cache_file)
empty_session = Roast::Cogs::Chat::Session.new([])
return Roast::Cogs::Chat::Output.new(empty_session, cached_response)
end
result = super
FileUtils.mkdir_p(cache_dir)
File.write(cache_file, result.response)
result
end
end
Roast::Cogs::Chat.prepend(CachedChat)
- 主要言語
- Ruby
- スター
- 1.3k
- フォーク
- 80
- 平均マージ
- 21分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/roast のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Shopify/roast#1009 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
KevinSaison/fuchikoma#14 ·
-
Mend: dependency security vulnerability
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
PowerShell session to_cmd doesn't escape embedded newlines/carriage returns, allowing statement injection対応中かも @kx7m2qd が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rapid7/metasploit-framework#22230 ·
メンテナーはふだん 2 日以内に返信
-
blast/small refactor risk/medium spend-dem
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
chriskelly/MusicWall#83 ·
メンテナーはふだん 1 日以内に返信