Skip to main content

llm-codegen-research

lint code workflow test code workflow release workflow test coverage

about

A collection of methods and classes I repeatedly use when conducting research on LLM code-generation. Covers both prompting various LLMs, and analysing the markdown responses.

installation

Install directly from PyPI, using pip:

pip install llm-codegen-research

This installs the core package, which includes code parsing and analysis utilities. To also install the LLM API client libraries, use the api extra:

pip install llm-codegen-research[api]

usage

First configure environment vairables for the APIs you want to use:

export OPENAI_API_KEY=...
export ANTHROPIC_API_KEY=...
export TOGETHER_API_KEY=...
export MISTRAL_API_KEY=...
export DEEPSEEK_API_KEY=...
export NSCALE_API_KEY=...

You can get a quick response from an LLM:

from llm_cgr import generate, Markdown

response = generate("Write python code to generate the nth fibonacci number.")

markdown = Markdown(text=response)

Or define a client to generate multiple repsonses, or have a chat interaction:

from llm_cgr import get_llm

# create the llm
llm = get_llm(
    model="gpt-4.1-mini",
    system="You're a really funny comedian.",
)

# get multiple responses and see the difference
responses = llm.generate(
    user="Tell me a joke I haven't heard before!",
    samples=3,
)
print(responses)

# or have a multi-prompt chat interaction
llm.chat(user="Tell me a knock knock joke?")
llm.chat(user="Wait, I'm meant to say who's there!")
print(llm.history)

development

Clone the repository code:

git clone https://github.com/itsluketwist/llm-codegen-research.git

We use uv for project management. Once cloned, create a virtual environment and install uv and the project:

python -m venv .venv

. .venv/bin/activate

pip install uv

uv sync --extra api

Use make commands to lint and test:

make lint

make test

Use uv to add new dependencies into the project and uv.lock:

uv add openai

Or to upgrade dependencies:

uv sync --extra api --upgrade

Check typings with ty:

ty check

Release files for llm-codegen-research 2.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-codegen-research 2.19
File Size Uploaded
llm_codegen_research-2.19.tar.gz 31.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-codegen-research 2.19
File Interpreter ABI Platform
llm_codegen_research-2.19-py3-none-any.whl Python 3 none any Details

Total release size: 71.7 kB

Release files / llm_codegen_research-2.19.tar.gz

Download URL llm_codegen_research-2.19.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8e09018ed1ac3d99b96dab83d4fe4567f3d57f3bb1d6b707bdbb4f51414405f7
BLAKE2b-256 checksum
How to use checksums
8c309afbc5cffabe9fd274b38092fe2c6bb301aef2d46eedf40127756387f34b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llm_codegen_research-2.19-py3-none-any.whl

Download URL llm_codegen_research-2.19-py3-none-any.whl
Size 40.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b72bf852c8c1b44f6093eb1f23eb09f1a79239594fb48cc7f09ba28f9d8b7672
BLAKE2b-256 checksum
How to use checksums
b221bf2e8ad0086c43bb2203191cc7e394156c55997c2783226b434c3c50d943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

2.19 This release

2 release files

2.18

2 release files

2.17

2 release files

2.16

2 release files

2.15

2 release files

2.14

2 release files

2.13

2 release files

2.12

2 release files

2.11

2 release files

2.10

2 release files

2.9.1

2 release files

2.9

2 release files

2.8

2 release files

2.7.1

2 release files

2.7

2 release files

2.6

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.15

2 release files

1.14

2 release files

1.13

2 release files

1.12

2 release files

1.11

2 release files

1.10

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page