입력, 출력, 메타데이터 및 앱을 통해 흐르는 데이터를 추적하는 것은 시스템 성능을 이해하는 데 중요합니다. 그러나 시간에 따른 앱 버전 관리도 코드나 애플리케이션 매개변수의 수정이 출력을 어떻게 변경하는지 이해하는 데 중요합니다. Weave의 Model 클래스는 이러한 변경 사항을 Weave에서 추적하는 방법입니다.이 튜토리얼에서 배울 내용:
This feature is not available in TypeScript yet. Stay tuned!
이제 invoke로 모델을 인스턴스화하고 호출할 수 있습니다:
Python
TypeScript
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."""# highlight-next-linedinos = 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."""# highlight-next-lineresult = dinos.invoke(sentence)print(result)
This feature is not available in TypeScript yet. Stay tuned!
.invoke를 호출한 후 Weave에서 트레이스를 볼 수 있습니다 이제 모델 매개변수와 코드를 추적합니다weave.op()로 장식된 모델 함수에 대해. 모델도 버전 관리되는 것을 볼 수 있으며, 이 경우 “v21”이고, 모델을 클릭하면 해당 버전의 모델을 사용한 모든 호출을 볼 수 있습니다weave.Model 사용에 관한 참고 사항:
Weave predict 대신 invoke를 함수 이름으로 사용할 수 있습니다 Model선호하는 경우.
Weave는 호출된 Models를 저장하고 버전 관리하기 때문에 이러한 모델을 내보내고 재사용할 수 있습니다.Model 참조 가져오기
Weave UI에서 특정 버전의 Model 참조를 얻을 수 있습니다Model 사용하기
Model 객체의 URI가 있으면 내보내고 재사용할 수 있습니다. 내보낸 모델은 이미 초기화되어 사용할 준비가 되어 있습니다:
Python
TypeScript
# the exported weave model is already initialised and ready to be called# highlight-next-linenew_dinos = weave.ref("weave:///morgan/jurassic-park/object/ExtractDinos:ey4udBU2MU23heQFJenkVxLBX4bmDsFk7vsGcOWPjY4").get()# set the client to the openai client againnew_dinos.client = clientnew_sentence = """I also saw an Ankylosaurus grazing on giant ferns"""new_result = new_dinos.invoke(new_sentence)print(new_result)
This feature is not available in TypeScript yet. Stay tuned!