Generative AI with LangChain: Build large language model (LLM) apps with Python, ChatGPT, and other LLMs
Ben Auffarthamazon.com
Generative AI with LangChain: Build large language model (LLM) apps with Python, ChatGPT, and other LLMs
When using LLMs, especially in long loops such as with map operations, it’s important to track the token usage and understand how much money you are spending.
By calculating distances between embeddings, we can perform tasks like search and similarity scoring, or classify objects, for example by topic or category.
the embed_documents() method is used to retrieve embeddings for multiple text inputs. The result is stored in the doc_vectors variable.
By incorporating outside knowledge, RALMs generate text that is more useful, nuanced, and factually correct.
code-bison generates code from natural language descriptions, with a max input of 4,096 tokens and an output of 2,048 tokens. codechat-bison is a chatbot that is fine-tuned to help with code-related questions. It has an input limit of 4,096 tokens and an output limit of 2,048 tokens. code-gecko suggests code completions.
Document loaders have a load() method that loads data from the configured source and returns it as documents. They may also have a lazy_load() method for loading data into memory as and when they are needed.
Map reduce chain in LangChain This approach’s implications are that it allows the parallel processing of documents and enables the use of LLMs for reasoning, generating, or analyzing individual documents and combining their outputs.
Hugging Face offer various other libraries within their ecosystem, including Datasets for dataset processing, Evaluate for model evaluation, Simulate for simulation, and Gradio for machine learning demos.
An embedding is a numerical representation of content in a way that machines can process and understand.