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!
# 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!