CodeChain
CodeChain is a library for generating and evaluating code with LLMs.
To install: pip install codechain
To install from source: pip install -e .
To run unit tests: python tests/*.py
Code completion
Usage is very simple:
from codechain.generation import CompleteCodeChain
from langchain.chat_models import ChatOpenAI
generator = CompleteCodeChain.from_llm(
ChatOpenAI(model="gpt-3.5-turbo", temperature=0.2)
)
result = generator.run("""
def fibonacci(n):
# Generate the n-th fibonacci number.
""")
print(result)
Output:
def fibonacci(n):
# Generate the n-th fibonacci number.
if n <= 0:
return "Invalid input. n must be a positive integer."
elif n == 1:
return 0
elif n == 2:
return 1
else:
fib_list = [0, 1]
for i in range(2, n):
fib_list.append(fib_list[i-1] + fib_list[i-2])
return fib_list[n-1]
LLM evaluation
See here for an example of how to use this library with HumanEval.
Metadata
Release files for codechain 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| codechain-0.0.5.tar.gz | 3.5 kB | Without provenance | Details for codechain-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codechain-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for codechain-0.0.5-py3-none-any.whl |
Total release size: 7.3 kB
Release files / codechain-0.0.5.tar.gz
| Download URL | codechain-0.0.5.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb5c5c475d46cff7888b89bc27814d67c82c2bc46e39387abf19c296f4b42ac6
|
|
BLAKE2b-256 checksum How to use checksums |
a76feac0204b19a64c02b5b4bfb31b3b9d9b4b9ff2c203c681f3f598024d3f05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / codechain-0.0.5-py3-none-any.whl
| Download URL | codechain-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d508207efecb103f1b08419c658e6854eb830d7691c91a1ffc2bab4ac1454a28
|
|
BLAKE2b-256 checksum How to use checksums |
8ef9b4e431595cd0f5983c7a4b7955a609d74f9be01db3fdc081ee6478f1faff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for codechain 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.