Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/debug_detector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
found=0
echo "Checking for python print statements"
prints=$(grep -nR --include='*.py' --exclude-dir=node_modules --exclude-dir=.venv --exclude-dir=.git --exclude-dir=.github --exclude-dir=build --exclude-dir=dist --exclude-dir=.svelte-kit -e 'print(' . || true)
prints=$(grep -nRP --include='*.py' --exclude-dir=node_modules --exclude-dir=.venv --exclude-dir=.git --exclude-dir=.github --exclude-dir=build --exclude-dir=dist --exclude-dir=.svelte-kit -e '(?<!\.)\bprint\(' . || true)
if [ -n "$prints" ]; then
echo "$prints"
found=1
Expand Down
12 changes: 11 additions & 1 deletion libs/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,19 @@ for task in tasks:

If you've already created a Kiln task and want to run it as part of a Python app you can follow this example.

**Step 1: Export your Kiln task/project**

You can run any Kiln task from code using it's project file/folder on disk. However, these folders can contain thousands of files relating to past runs and evals, which is more than you probably want to deploy to a service. Only a few of these files are needed for running the task: you can export a minimal project folder with on the necessary files to run a task by running our CLI:

```bash
uvx kiln_ai package_project "/path/to/your/project.kiln" -t TASK_ID_TO_EXPORT
```

**Step 2: Run Kiln Task from Code**

Prerequisites:

- Already have a Kiln Task created and saved to disk at `TASK_PATH`. It doesn't matter if you created it using the Kiln app or the library.
- Already have a Kiln Task created and saved to disk at `TASK_PATH`. It doesn't matter if you created it using the Kiln app, the Kiln library, or exported it using the command above.
- Set a default run configuration in the Kiln UI specifying how to run the task: model, AI provider, etc. Alternatively you can create a RunConfigProperties instance in code.
- Set up any API keys required for the task. If running on the same machine as the Kiln app, these will already be saved in `~/.kiln_ai/settings.yaml` and will be loaded automatically. If running on a server, you can set the required environment variables (see `libs/core/kiln_ai/utils/config.py` for a list).
- If your task uses RAG, ensure you have run search indexing on this machine with the Kiln UI or via the library.
Expand Down
3 changes: 3 additions & 0 deletions libs/core/kiln_ai/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from kiln_ai.cli.cli import app

__all__ = ["app"]
12 changes: 12 additions & 0 deletions libs/core/kiln_ai/cli/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import typer

from kiln_ai.cli.commands import package_project, projects, tasks

app = typer.Typer(
help="Kiln AI CLI - Build AI systems with evals, data gen, fine-tuning, and more.",
no_args_is_help=True,
)

app.add_typer(projects.app, name="projects")
app.add_typer(tasks.app, name="tasks")
app.command(name="package_project")(package_project.package_project)
Empty file.
Loading
Loading