Summarization
Summaries of short text
1 | from langchain.llms import OpenAI |
Summaries for longer text
1 | with open('data/PaulGrahamEssays/good.txt', 'r') as file: |
Question & Answering using documents as context
llm(your context + your question) = your answer
Use Embeddings
Process:
- Split the texts (only pass the most relavent content to the model, not everything)
- Putting the embeddings in a DB
- Query them
1 | from langchain import OpenAI |
If you wanted to do more you would hook this up to a cloud vector database, use a tool like metal and start managing your documents, with external data sources
Extraction
Extraction is the process of parsing data from a piece of text. This is commonly used with output parsing in order to structure our data.
- Library: kor
1 | # To help construct our Chat Messages |
Vanilla Extraction
1 | instructions = """ |
Using LangChain’s Response Schema
1 | # The schema I want out |
Evaluation
Quality checks on the output of the applications.
1 | from langchain.evaluation.qa import QAEvalChain |
Query from databases
1 | from langchain import OpenAI, SQLDatabase, SQLDatabaseChain |