/Ollama_GoogleColab_colabxterm_langchain

This repo contains a code that uses colabxterm and langchain community packages to install Ollama on Google Colab free tier T4 and pulls a model from Ollama and chats with it

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Ollama integration with Google Colab

  1. In your Google Colab notebook, install the necessary Python packages.

  2. Load the xterm extension to use a terminal within a Colab notebook.

  3. Open the terminal inside the Colab cell by running:

    %xterm

  4. nside the xterm terminal (opened within the Colab cell):

  • Type the following command to install Ollama:

    curl -fsSL https://ollama.com/install.sh | sh

  • Type the following command to install Ollama:

    ollama serve & ollama run llama3

  1. After leaving the xterm terminal, import the Ollama class from the LangChain community library.

  2. Use the llm.invoke() method to prompt the model and receive its response.

Reference: https://www.youtube.com/watch?v=LN9rlGNaXUA&ab_channel=AkashDawari