Skip to content

Instantly share code, notes, and snippets.

@arun-gupta
Last active November 7, 2023 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun-gupta/5c852e1b86f66645d89bca0f9e9a4df3 to your computer and use it in GitHub Desktop.
Save arun-gupta/5c852e1b86f66645d89bca0f9e9a4df3 to your computer and use it in GitHub Desktop.
Building first LLM using LangChain
  • Install Python 3.11.6 from https://www.python.org/downloads/macos/. Python is installed in /Library/Frameworks/Python.framework. The default command names as python3 and pip3.
  • Create a new virtual environment: python3 -m venv llm
  • Activate the environment: cd llm; source bin/activate
  • Upgrade pip: pip install --upgrade pip
  • Check the environment:
    pip list
    Package    Version
    ---------- -------
    pip        23.3.1
    setuptools 65.5.0
    
  • Install OpenAI: pip install openai
  • Install LangChain: pip install langchain
  • Check the list of packages:
    pip list
    Package            Version
    ------------------ ---------
    aiohttp            3.8.6
    aiosignal          1.3.1
    annotated-types    0.6.0
    anyio              3.7.1
    async-timeout      4.0.3
    attrs              23.1.0
    certifi            2023.7.22
    charset-normalizer 3.3.2
    dataclasses-json   0.6.1
    frozenlist         1.4.0
    idna               3.4
    jsonpatch          1.33
    jsonpointer        2.4
    langchain          0.0.330
    langsmith          0.0.57
    marshmallow        3.20.1
    multidict          6.0.4
    mypy-extensions    1.0.0
    numpy              1.26.1
    openai             0.28.1
    packaging          23.2
    pip                23.3.1
    pydantic           2.4.2
    pydantic_core      2.10.1
    PyYAML             6.0.1
    requests           2.31.0
    setuptools         65.5.0
    sniffio            1.3.0
    SQLAlchemy         2.0.23
    tenacity           8.2.3
    tqdm               4.66.1
    typing_extensions  4.8.0
    typing-inspect     0.9.0
    urllib3            2.0.7
    yarl               1.9.2
    
  • Create OpenAI key.
  • Set up an environment variable for the key: export OPENAI_API_KEY="..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment