Weave ops는 실험의 재현성과 추적 가능성을 높이는 강력한 방법입니다. 코드를 자동으로 버전 관리하고 입력과 출력을 캡처해 줍니다. 다음은 Cerebras SDK와 함께 Weave ops를 활용하는 예입니다:
import osimport weavefrom cerebras.cloud.sdk import Cerebras# Weave 프로젝트 초기화weave.init("cerebras_speedster")client = Cerebras(api_key=os.environ["CEREBRAS_API_KEY"])# Weave가 이 함수의 입력, 출력 및 코드를 추적합니다@weave.opdef animal_speedster(animal: str, model: str) -> str: "동물이 얼마나 빨리 달릴 수 있는지 알아보기" response = client.chat.completions.create( model=model, messages=[{"role": "user", "content": f"How fast can a {animal} run?"}], ) return response.choices[0].message.contentanimal_speedster("cheetah", "llama3.1-8b")animal_speedster("ostrich", "llama3.1-8b")animal_speedster("human", "llama3.1-8b")