Weave Model を使用して、アプリケーションとそのパラメーターをトラッキングし、バージョン管理する方法を学びます
入力、出力、メタデータのトラッキングや、アプリケーション内を流れるデータの把握は、システムのパフォーマンスを理解するうえで不可欠です。時間の経過に伴ってアプリケーションをバージョン管理することも同様に重要です。これにより、コードやパラメーターの変更が出力にどのような影響を与えるかを確認できます。Weave の Model クラスは、こうした変更をトラッキングします。このチュートリアルは、LLM アプリケーションの異なるバージョン間で結果を比較し、再現したい開発者向けです。最後には、アプリケーションのパラメーターとコードを保持する、バージョン管理された Weave Model を作成できるようになります。また、以前のバージョンを取得して再利用する方法も学べます。このチュートリアルでは、次の内容を学びます。
Weave Model を使用して、アプリケーションとそのパラメーターをトラッキングし、バージョン管理する方法。
weave.init('jurassic-park')client = OpenAI()system_prompt = """Extract any dinosaur `name`, their `common_name`, \names and whether its `diet` is a herbivore or carnivore, in JSON format."""dinos = ExtractDinos( client=client, model_name='gpt-4o', temperature=0.4, system_prompt=system_prompt)sentence = """I watched as a Tyrannosaurus rex (T. rex) chased after a Triceratops (Trike), \both carnivore and herbivore locked in an ancient dance. Meanwhile, a gentle giant \Brachiosaurus (Brachi) calmly munched on treetops, blissfully unaware of the chaos below."""result = dinos.invoke(sentence)print(result)