Key resources
Take aways from each lesson
| Lesson & Notebook | Summary of key points & Callouts |
|---|---|
| L1-openai-functions.ipynb | - How to define tools/functions for OpenAI ChatCompletion and pass it, and eventually, execute it.- Different variants of Function Calling. - function_call="auto" ⇒ LLM will decide when to call the function.- function_call="none"⇒ LLM will not call the function. - function_call={"name": "<function_name>"}⇒ LLM will call this function forcefully.- Different roles in ChatCompletion- user- assistant- function |
| L2-lcel.ipynb | LCEL intro - Simple chain ( chain = prompt | model | output_parser) which is invoked using - prompt ( ChatPromptTemplate)- model ( ChatOpenAI)- output_parser ( StrOutputParser)- More complex chain that uses chain = RunnableMap(...) | prompt | model | output_parser, where we are also introduced to vectorstores retriever- Leverage binding to create reusable components, such as creating a model with functions binded to it.- e.g., model = ChatOpenAI(temperature=0).bind(functions=functions)- Also, used ChatPromptMessage (for multi-turn, role-based prompts), which is different from ChatPromptTemplate (simple, single human message prompts)- Using Fallbacks to handle failure scenarios - e.g., final_chain = simple_chain.with_fallback([complex_chain])- Leverage Interface components - invoke [ainvoke]- batch [abatch]- stream [astream] |
| L3-function-calling.ipynb | - Intro to Pydantic, and few examples to create data structures - Nesting data structures with Pydantic - Pydantic to OpenAI function definition (json schema) - convert_pydantic_to_openai_function- Nested data structures - e.g., class User(BaseModel) - e.g., class Class(BaseModel): Users: List[User]<br> students: List[User]- Few other scenarios/examples covering previously discussed techniques like - Forcing to use a function - Using in a chain - Using multiple functions |
| L4-tagging-and-extraction.ipynb | - LLM evaluate the input text, and generate structured output - Tagging intro - Assigns descriptive categories or labels - e.g., {sentiment: positive, language: spanish}- Extraction intro - Retrieves specific information or entities - e.g., {first name: Lang, last name: Chain, title: Mr}- Using text_splitter along with RunnableLambda to handle really long articles/content |
| L5-tools-routing-apis.ipynb | |
| L6-functional_conversation.ipynb |