LLMPromptConfigObject#
- class council.prompt.LLMPromptConfigObject(kind: str, version: str, metadata: DataObjectMetadata, spec: T)[source]#
Bases:
DataObject
[LLMPromptConfigSpec
]Helper class to instantiate a LLMPrompt from a YAML file
- get_system_prompt_template(model: str) str [source]#
Return system prompt template for a given model.
- get_user_prompt_template(model: str) str [source]#
Return user prompt template for a given model. Raises ValueError if no user prompt template was provided.
- property has_user_prompt_template: bool#
Return True, if user prompt template was specified in yaml file.
Code Example#
The following code illustrates the way to load prompt from a YAML file.
from council.prompt import LLMPromptConfigObject
prompt = LLMPromptConfigObject.from_yaml("data/prompts/llm-prompt-sql-template.yaml")
system_prompt = prompt.get_system_prompt_template("default")
user_prompt = prompt.get_user_prompt_template("default")
Sample yaml file:
kind: LLMPrompt
version: 0.1
metadata:
name: "SQL_template"
description: "Prompt template used for SQL generation"
labels:
abc: xyz
spec:
system:
- model: default
template: |
You are a sql expert solving the `Task`
leveraging the database schema in the `DATASET` section.
# Instructions
- Assess whether the `Task` is reasonable and possible
to solve given the database schema
- Keep your explanation concise with only important details and assumptions
{dataset_description}
# Response formatting
Your entire response must be inside the following code blocks.
All code blocks are mandatory.
```solved
True/False, indicating whether the task is solved
```
```explanation
String, concise explanation of the solution if solved or reasoning if not solved
```
```sql
String, the sql query if the task is solved, otherwise empty
```
user:
- model: default
template: |
{question}