GithubHelp home page GithubHelp logo

imtaotao / generative_ai_with_langchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benman1/generative_ai_with_langchain

0.0 0.0 0.0 1.82 MB

Build large language model (LLM) apps with Python, ChatGPT and other models. This is the companion repository for the book on generative AI with LangChain.

Home Page: https://amzn.to/3D5ZhGu

Python 8.38% Makefile 0.06% HTML 0.76% Jupyter Notebook 90.68% Dockerfile 0.12%

generative_ai_with_langchain's Introduction

Generative AI with LangChain

Create generative AI apps with LangChain.

Environment

You can install your local environment with conda (recommended) or pip. The environment configurations for conda and pip are provided. Please note that if you choose pip as you installation tool, you might need additional tweaking.

If you have any problems with the environment, please raise an issue, where you show the error you got. If you feel confident, please go ahead and create a pull request.

For pip and poetry, make sure you install pandoc in your system. On MacOS use brew:

brew install pandoc

On Ubuntu or Debian linux, use apt:

sudo apt-get install pandoc

On Windows, you can use an installer.

Conda

This is the recommended method for installing dependencies. Please make sure you have anaconda installed.

First create the environment for the book that contains all the dependencies:

conda env create --file langchain_ai.yaml --force

The conda environment is called langchain_ai. You can activate it as follows:

conda activate langchain_ai 

Pip

Pip is the default dependency management tool in Python. With pip, you should be able to install all the libraries from the requirements file:

pip install -r requirements.txt

If you are working with a slow internet connection, you might see a timeout with pip (this can also happen with conda and pip). As a workaround, you can increase the timeout setting like this:

export PIP_DEFAULT_TIMEOUT=100

Docker

There's a docker file for the environment as well. It uses the docker environment and starts an ipython notebook. To use it, first build it, and then run it:

docker build -t new_image .
docker run -it new_image

You should be able to find the notebook in your browser at http://localhost:8080.

Poetry

Make sure you have poetry installed. On Linux and MacOS, you should be able to use the requirements file:

poetry install

This should take the pyproject.toml file and install all dependencies.

Code validation

I've included a Makefile that includes instructions for validation with flake8, mypy, and other tools. I have run mypy like this:

make typecheck

To run the code validation in ruff, please run

ruff check .

Contributing

If you find anything amiss with the notebooks or dependencies, please feel free to create a pull request.

If you want to change the conda dependency specification (the yaml file), you can test it like this:

conda env create --file langchain_ai.yaml --force

You can update the pip requirements like this:

pip freeze > requirements.txt

Please make sure that you keep these two ways of maintaining dependencies in sync.

Then make sure, you test the notebooks in the new environment to see that they run.

generative_ai_with_langchain's People

Contributors

benman1 avatar mekasone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.