04. JSON output parser (JsonOutputParser)
JsonOutputParser
This output parser allows the user to specify the desired JSON schema, which results in by viewing data from the LLM to suit that schema.
In order for LLM to process data accurately and efficiently to generate the desired form of JSON, the capacity of the model (meaning intelligence here). Yes. Please note that llama-70B is larger than llama-8B) and this should be enough.
Copy
from dotenv import load_dotenv
load_dotenv()Copy
TrueCopy
# LangSmith Set up tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging
# Enter a project name.
logging.langsmith("CH03-OutputParser")Copy
Start tracking LangSmith.
[Project name]
CH03-OutputParser Copy
Copy
Define the desired output structure.
Copy
JsonOutputParser Set the parser using, and inject the instruction clause into the prompt template.
Copy
Copy
Pydantic use
You can use this feature without Pydantic. In this case, I request to return JSON, but it does not provide specific information on how the schema should be.
Copy
Copy
Last updated