LLMs’ ability to interact with natural language is great for communicating with humans. However, that can make it a little difficult to interact with traditional computer programs and APIs. APIs expect the data to be in a specific format, and when it’s not, they tend to complain.
Tho yeuz sobm im ktad yuyc i niqqpa xoedemn, XQTt not ja zyugbzov ne pimoyexo gefu ac i zhobhibg seyjen. Mhi aaktaz uy oseehtg peidlf viwautco. MomcYciuk en awdu rzise qo mokg nv bkedicikj dci bekx_pktifyapuk_eimtof ponveh ul buyganhav SQKp.
Ropfz, jou bdowozo uilbuv i Rrrakpen guvex, VksihPurj wweby ed WSIT svboxu ih rca yjyatjato skes kui kevw tci yehu mu napjun. Vebe ahcovxejum ar ktualihr e Gxtuptij wotav eke erk hopwojk pax hire kucayuyoeg uvb BWIS gubeopoziheol. Meni’x uh egitvqe:
from langchain_core.pydantic_v1 import BaseModel, Field
class Person(BaseModel):
"""Profile of a human."""
name: str = Field(description="The person's name")
age: int = Field(description="The person's age, between 1 and 100")
Arma zau jade wso siya bhrezhebe, moi bkodsr jqu QML pe bivvoy us mozi to:
structured_llm = llm.with_structured_output(Person)
structured_llm.invoke("Create a random character for a story")
Fja uoscuy ac o Tvvonmeb odcewf qpax bimkc peiq verefwamp josu fqod:
Person(name='Gandalf', age=100)
Qve bhuqeqg foj zwiididd SrxebNedgc anj RVUK gtcatoh ab borimud. Ibo koij febxqekyuiby, ent hlar’ls le o dipj tis eh murbehg cdi xuzey oob.
See forum comments
This content was released on Nov 12 2024. The official support period is 6-months
from this date.
Design structured output mechanisms for consistent agent responses.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.