https://github.com/timesurgelabs/langchain-task-template
Template for generating tasks for a larger LangChain LLM project
https://github.com/timesurgelabs/langchain-task-template
langchain langchain-python llm python
Last synced: 2 months ago
JSON representation
Template for generating tasks for a larger LangChain LLM project
- Host: GitHub
- URL: https://github.com/timesurgelabs/langchain-task-template
- Owner: TimeSurgeLabs
- License: mit
- Created: 2024-02-14T01:53:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T02:24:05.000Z (over 2 years ago)
- Last Synced: 2025-01-20T05:42:51.281Z (over 1 year ago)
- Topics: langchain, langchain-python, llm, python
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Langchain Task Template repo
This is a template repo that is meant to be used whenever you are trying to use LangChain to automate some task with LLMs. This example takes about three minutes to run.
# Best practices
First, you should define what it is you are trying to have the LLM accomplish in the form of a simple step by step guide.
An example is in [how_to_make_good_polls.md](how_to_make_good_polls.md).
This will be your guide for structuring the tool you are trying to make.
For each step you can try:
* Asking chatgpt outright to do it in the form of a prompt, be sure to ask for its reasoning, encourage it, and include few shot prompting/examples,
* Iterate to make a part of it better
* Rank output and cherry pick the best option
# Install Dependencies
- Python 3.11+
- Poetry
- For installation, see their [official docs](https://python-poetry.org/docs/#installing-with-the-official-installer).
# Installation
```sh
poetry install --no-root
cp example.env .env # put the proper env vars here
```
# Run the project
```
poetry run python main.py generate_poll --topic "programming"
poetry run python main.py generate_question --topic "programming"
poetry run python main.py generate_answers --question "which programming language is easiest to use"
poetry run python main.py rank_poll --topic "programming" --target_audience "software developers" # generates and ranks a poll
```
# Relevant links
* [OpenAI Docs](https://platform.openai.com/docs/guides/text-generation)
* [LangChain Quickstart](https://python.langchain.com/docs/get_started/quickstart)