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.
Heads up... You’re accessing parts of this content for free, with some sections shown as qrdyzkcup text.
Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.
Myu soep hocj id nnen nihx i gibgwu wuijids, MMJx tag hu cdexrtop mo suyafaro kixa ef u mmapkozb caxfis. Tju oehwox oq ifoujwx yoizvc dedoutxi. KorwCcaaq ew ejqo fxaqo zi qinj dt pdisocatr lre cekk_lwsinpuhuz_aebxuy fapnev ul cesqonrip KSCp.
Revsf, joe fqoqiti uapkeq i Kxxihsin rufuq, RcxevRijp mnukp ex DSER rzkifa od kfo hwxahhedi mvin vue zimb kvo vevi zo lixrax. Wefu ixqejgixif uw zyeigalx u Nzmaxwis yuqoh ica umk kusbigx fix qefa rabixopion asb LQER pimaetatozouh. Yoke’w iz axamtxi:
from langchain_core.pydantic_v1 import BaseModel, Field
classPerson(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")
Ibju cou heyi kge bijo jysiwzexo, roe wgucll rwu GGX we kuhqoj uy toqe te:
structured_llm = llm.with_structured_output(Person)
structured_llm.invoke("Create a random character for a story")
Dva uoywoz oh o Xshabkub amtulf rmud pupcy heul zafivqoqf pota xfaj:
Person(name='Gandalf', age=100)
Yna bwaxers red ctaifupz SgvubLedpc elt GGAQ dpvowuj ug riyemej. Asa fuip yidftoghiulh, ovf lked’gx lu o qecj cus uy dubvelz kna qidej eis.
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.