https://github.com/upsonic/prompt-as-function
"Don't write any code, just tell what to do!"
https://github.com/upsonic/prompt-as-function
llm prompt python
Last synced: about 1 month ago
JSON representation
"Don't write any code, just tell what to do!"
- Host: GitHub
- URL: https://github.com/upsonic/prompt-as-function
- Owner: Upsonic
- License: mit
- Created: 2024-08-04T16:44:50.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-08-16T15:51:16.000Z (about 1 year ago)
- Last Synced: 2024-09-16T19:11:47.295Z (about 1 year ago)
- Topics: llm, prompt, python
- Language: Python
- Homepage:
- Size: 50.8 KB
- Stars: 3
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prompt as Function
**"Don't write any code, just tell what to do!"**This is a significant milestone for Large Language Models (LLMs) and the coding process. The `prompt-as` library serves as a foundation for using prompts to perform tasks in Python. We are currently developing this mindset for several features in our products. With our open-source initiative <3, you can use it just like we do.
```console
pip install prompt-as
``````python
from prompt_as import prompt_as_config, pfprompt_as_config.OPENAI_API_KEY = "sk-**"
@pf
def sleep(second:str) -> bool:
"""
Sleeps for the given seconds and returns True.
"""```
[Example @pf Functions](https://github.com/Upsonic/prompt-as-function/blob/master/examples.md)
# Testing and Settings
Model Settings
You can change the OpenAI model that have been used for `prompt-as`.```python
from prompt_as import prompt_as_config, pfprompt_as_config.OPENAI_MODEL = "gpt-4-turbo"
# Model Settingprompt_as_config.OPENAI_API_KEY = "sk-**"
@pf
def sleep(second:str) -> bool:
"""
Sleeps for the given seconds and returns True.
"""```
Testing
If you want to test this library on a large scale, you can use our test system as well.
```python
from prompt_as import prompt_as_config, pf
prompt_as_config.OPENAI_API_KEY = "sk-**"
@pf
def sleep(second:str) -> bool:
"""
Sleeps for the given seconds and returns True.
"""# Testing
from prompt_as import Prompt_As_Test_System
Prompt_As_Test_System(sleep_time, [(["2"], {})], [True], [False]).run_test()
# (function_name, test_args_and_kwargs, expected_outputs, bad_outputs)```
Quality Testing
If you want to test the working quality of this library, you can use the many different quality tests created.
```python
from prompt_as.tests.quality_test import quality_test
quality_test.run_tests()
```