<h1 align="center">
<a href="https://prompts.chat">
We welcome contributions from every respectful contributor!
Sign in to like and favorite skills
We welcome contributions from every respectful contributor!
There are multiple ways you can contribute to phospho:
job_libraryThis guide will focus on how to add jobs to the phospho library.
Install poetry and the phospho project:
curl -sSL https://install.python-poetry.org | python3 - cd phospho-python poetry install
Create a new job in
phospho-python/lab/job_library.py by taking an existing job as an example.
# A Job is a function that takes as first parameter a Message and that returns a JobResult # Additional parameters can be specified def prompt_to_bool( message: Message, prompt: str, format_kwargs: Optional[dict] = None, model: str = "gpt-3.5-turbo", ) -> JobResult: """ Runs a prompt on a message and returns a boolean result. """ # Call any LLM models or API in the job openai_model = OpenAIModel(config.OPENAI_API_KEY, model) if format_kwargs is None: format_kwargs = {} formated_prompt = prompt.format( message_content=message.content, message_context=message.previous_messages_transcript(with_role=True), **format_kwargs, ) llm_response = openai_model.invoke(formated_prompt).strip() if llm_response is None: bool_response = False else: bool_response = llm_response.lower() == "true" # Return a JobResult return JobResult( job_id="prompt_to_bool", result_type=ResultType.bool, value=bool_response, logs=[formated_prompt, llm_response], )
Using this framework will allow the job to be compatible with the
.optimize method (to figure out the best set of parameters) and the exported results (to store the analytics in a standard way).
We use pytest for testing. Test files are located in the
phospho-python/tests folder. To run the tests, use the following command:
poetry run pytest
To build the package locally, run :
poetry build
You can then import the built package (even in a different project and environment) using (replace with the path to the actual file) :
pip install path/to/dist/phospho-0.1.0.tar.gz
You can also test your dockerfiles locally by running
docker build -t <name ie frontend, backend, etc...> .
or
docker build --file <./filename> -t <name ie frontend, backend, etc...> .
temporal server start-dev --db-filename your_temporal.db --ui-port 8080
In github, create a Pull Request targeting the
dev branch.
Publishing is handled by Github Actions when maintainers create a new release.
pyproject.toml