A sample script that uses LangChain to talk to LLMs.
Based on https://python.langchain.com/docs/tutorials/llm_chain/
You’ll need an API key for each LLM. So just follow the instructions linked below to obtain your API keys.
Save the keys to the app/src/main/resources/.env file as the corresponding
..._API_KEY environment variable. You can use
app/src/main/resources/.env.template as a guide to structure your .env
file.
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt. .venv/bin/activateThe sample logic is in the file main.py.
It asks for an Italian translation of "Hi".
To run against OpenAI's ChatGPT:
python main.py --model openaiTo run against Anthropic's Claude:
python main.py --model anthropicTo run against Google's Gemini:
python main.py --model googleTo run against DeekSeek's R1:
python main.py --model deepseekIf you don't specify --model, it will default to openai and use ChatGPT.