Ollama Langchain Devcontainer
- Install Docker
- Follow the post installation steps
- Install Docker Compose
git clone git@github.com:rayedbw/llamachain.git
cd llamachain
- Open the project in vscode
code .
- Install the
Dev Container
extension pack Ctrl + Shift + P
to open the command palette and type Rebuild and Reopen in Container
In a terminal window outside of the container run the following to download the llama2 model in your container:
docker exec llamachain-ollama-1 ollama pull llama2
python src/main.py
or press F5
docker exec llamachain-ollama-1 ollama pull gemma
to try the gemma model
Don't forget to actually use the model in your code by changing the model
parameter.
from langchain_community.chat_models.ollama import ChatOllama
llm = ChatOllama(model="gemma", base_url=os.environ["OLLAMA_BASE_URL"])
- Create an api key from the OpenAI website
- Create a
.env
file at the project root - Add
OPENAI_API_KEY=<your_api_key>