# PyLLM: In-Line Executable Code Generation Using LLMs
PyLLM harnesses the power of Large Language Models (LLMs) to generate and execute code during runtime. Whether you're automating routine tasks, solving complex problems, or just experimenting with AI-generated code, PyLLM provides a seamless and intuitive interface for code generation and execution.
## Features
- Dynamic Code Generation: Generate functions on-the-fly in one line.
- Unit Testing: Specify unit tests to ensure the generated code meets your requirements.
- Caching Mechanism: Avoid re-generating code for repeated requests with an optional caching feature.
- Customizable: Easily tune your prompt template and sampling parameters.
## Installation
```
pip install pyllm-code
```
## Quick Start
Here's a simple example to get you started with PyLLM. The following code generates a function to swap two numbers:
```
from pyllm import CodeLLM
llm = CodeLLM()
swap_numbers = llm.def_function(
"Swap two input numbers", unit_tests=[((1, 2), (2, 1))]
)
print(swap_numbers(20, 40))
# Output: (40, 20)
```
## Usage
To generate a function using PyLLM, create a CodeLLM instance and use the function method with the desired description and unit tests:
```
from pyllm import CodeLLM
# Initialize the LLM interface
llm = CodeLLM()
# Generate a function
my_function = llm.def_function(
"Function description here",
unit_tests=[("input_example", "expected_output")],
use_cached=True # Set to False to disable caching
)
```
## Contributing
Contributions are welcomed from the community, whether it's in the form of bug reports, feature requests, or code contributions. Please refer to our CONTRIBUTING.md for guidelines on how to contribute.
## License
PyLLM is released under the MIT license. See the LICENSE file for more details.
## Support
If you encounter any issues or have questions, please file an issue on our GitHub repository.
Enjoy crafting code with AI through PyLLM!
Raw data
{
"_id": null,
"home_page": "https://github.com/HishamYahya/PyLLM",
"name": "pyllm-code",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "LLM,LLMs,assistant,helper,coding,automation,AI,NLP",
"author": "Hisham Alyahya",
"author_email": "Hishamaalyahya@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/21/16/67f0352c2781ea92c9ca08813af35473ce2692be67240cecd1e483ec0ddb/pyllm-code-0.0.2.tar.gz",
"platform": null,
"description": "# PyLLM: In-Line Executable Code Generation Using LLMs\nPyLLM harnesses the power of Large Language Models (LLMs) to generate and execute code during runtime. Whether you're automating routine tasks, solving complex problems, or just experimenting with AI-generated code, PyLLM provides a seamless and intuitive interface for code generation and execution.\n\n## Features\n- Dynamic Code Generation: Generate functions on-the-fly in one line.\n- Unit Testing: Specify unit tests to ensure the generated code meets your requirements.\n- Caching Mechanism: Avoid re-generating code for repeated requests with an optional caching feature.\n- Customizable: Easily tune your prompt template and sampling parameters.\n\n## Installation\n```\npip install pyllm-code\n```\n\n## Quick Start\nHere's a simple example to get you started with PyLLM. The following code generates a function to swap two numbers:\n\n```\nfrom pyllm import CodeLLM\n\nllm = CodeLLM()\nswap_numbers = llm.def_function(\n \"Swap two input numbers\", unit_tests=[((1, 2), (2, 1))]\n)\nprint(swap_numbers(20, 40))\n# Output: (40, 20)\n```\n\n## Usage\nTo generate a function using PyLLM, create a CodeLLM instance and use the function method with the desired description and unit tests:\n\n```\nfrom pyllm import CodeLLM\n\n# Initialize the LLM interface\nllm = CodeLLM()\n\n# Generate a function\nmy_function = llm.def_function(\n \"Function description here\",\n unit_tests=[(\"input_example\", \"expected_output\")],\n use_cached=True # Set to False to disable caching\n)\n```\n\n## Contributing\nContributions are welcomed from the community, whether it's in the form of bug reports, feature requests, or code contributions. Please refer to our CONTRIBUTING.md for guidelines on how to contribute.\n\n## License\nPyLLM is released under the MIT license. See the LICENSE file for more details.\n\n## Support\nIf you encounter any issues or have questions, please file an issue on our GitHub repository.\n\nEnjoy crafting code with AI through PyLLM!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Leverage LLMs to generate and execute robust code dynamically through an intuitive and easy-to-use API!",
"version": "0.0.2",
"project_urls": {
"Download": "https://github.com/HishamYahya/PyLLM/archive/refs/tags/v0.0.2.tar.gz",
"Homepage": "https://github.com/HishamYahya/PyLLM"
},
"split_keywords": [
"llm",
"llms",
"assistant",
"helper",
"coding",
"automation",
"ai",
"nlp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "211667f0352c2781ea92c9ca08813af35473ce2692be67240cecd1e483ec0ddb",
"md5": "1f74d87598d8d979e683d761cae75bd3",
"sha256": "079e51f42c7bdcbc79faeb9c01106df0292e3c25493195950166a4aa786180aa"
},
"downloads": -1,
"filename": "pyllm-code-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "1f74d87598d8d979e683d761cae75bd3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13305,
"upload_time": "2024-02-05T17:32:29",
"upload_time_iso_8601": "2024-02-05T17:32:29.921840Z",
"url": "https://files.pythonhosted.org/packages/21/16/67f0352c2781ea92c9ca08813af35473ce2692be67240cecd1e483ec0ddb/pyllm-code-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-05 17:32:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HishamYahya",
"github_project": "PyLLM",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyllm-code"
}