Exercise#2 Create LLM Utility

Objective

  • The objective is to try out the real LLM with invoke, stream and batch functions.

  • The code provided in this course uses a utility class to create LLMs. Another objective is to go over the create LLM utility code.

Part-1 Try out real LLMs

  • Open the notebook
  • There is code to create multiple LLMs as instance of LangChain LLM class
  • Select/run some of the LLMs to understand the code for the creation of LLM
  • You will need to provide the API key

Local Jupyter Lab setup

working-with-llms

Google colab

  • Open the notebook in Google colab
  • Make sure to run the required cells !!! otherwise you will get errors
Open In Colab

Part-2 Review the code in the utility

  • In part-1 you learned the raw code for creating the LLM

  • In part-2 you will find the same code in a Python file exposed as a utility

  • Create LLM for text generation and other tasks create-llm-utility

  • Create Chat LLM for multi-turn Q&A and Chatbots create-chat-llm-utility

Try out the utility

Jupyter Lab

setup-test-api-keys

  • You have tried the code in this utility to test out API key setup
Google colab
Open In Colab