LLMs4PCG
LLMs4PCG is a python package containing required and utility functions as a part of LLMs4PCG competition.
Installation
Use the package manager pip to install LLMs4PCG.
pip install llms4pcg
Dependency
This file uses the following Python libraries:
openai
Functions
run_evaluation(team_name: str, fn: Type[TrialLoop], num_trials=10, characters: list[str] = None, model_name=None, local_model_base_url=None)
This function runs a trial for each character in the alphabet for a given team. It creates directories for logging and output, and generates a log file with a timestamp and timezone in the filename. It then runs trials for each character, skipping any that already exist.
To use local LLM, specify model_name and local_model_base_url parameters. If model_name is not specified, it will
use the default model name gpt-3.5-turbo. If local_model_base_url is not specified, it will use the default base
url of OpenAI API.
run_trial(ctx: TrialContext, fn: Type[TrialLoop])
This function runs a single trial. It writes the result of the trial to the log file and the final response to a text file in the output directory.
chat_with_llm(ctx: TrialContext, messages: []) -> list[str]
This function chats with the LLM. It sends a list of messages to the LLM and writes the response and token counts to the log file. It also checks for time and token limits, raising errors if these are exceeded.
Usage
To use this file, import it and call the run_evaluation function with the team name and trial loop function as
arguments. You can also specify the number of trials to run and the characters to run trials for.
from llms4pcg.competition import run_evaluation, TrialLoop, TrialContext, chat_with_llm
class ZeroShotPrompting(TrialLoop):
@staticmethod
def run(ctx: TrialContext, target_character: str) -> str:
message_history = [{
"role": "user",
"content": "Return this is a test message."
}]
response = chat_with_llm(ctx, message_history)
return response[0]
run_evaluation("y_wing", ZeroShotPrompting)
Metadata
Release files for llms4pcg 2.0.1
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 | |
|---|---|---|---|---|
| llms4pcg-2.0.1.tar.gz | 7.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llms4pcg-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / llms4pcg-2.0.1.tar.gz
| Download URL | llms4pcg-2.0.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74c04227bc2384d9e6b585d411c44e9d420b7bebe46941d39ab97d30f760e9bb
|
|
BLAKE2b-256 checksum How to use checksums |
be16b381d35b15e39382707fd52008943254fa4493aaed3e1ac6dcb6e89be179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / llms4pcg-2.0.1-py3-none-any.whl
| Download URL | llms4pcg-2.0.1-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e07bdcf0622426170bc8a3c777e8c9baa40eac147e5c2212a9ef14b26b1122a
|
|
BLAKE2b-256 checksum How to use checksums |
5d99e962829df5a9182f946c07299a6b66c947290030d73aa7e4e9836c06137d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for llms4pcg 2.0.1
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.