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
9 changes: 2 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- vim-markdown-toc GFM -->

* [TLDR;](#tldr)
* [Prerequisities](#prerequisities)
* [Prerequisites](#prerequisites)
* [Tooling installation](#tooling-installation)
* [Setting up your development environment](#setting-up-your-development-environment)
* [Definition of Done](#definition-of-done)
Expand All @@ -15,11 +15,6 @@
* [Type hints checks](#type-hints-checks)
* [Linters](#linters)
* [Security checks](#security-checks)
* [Testing](#testing)
* [Tips and hints for developing unit tests](#tips-and-hints-for-developing-unit-tests)
* [Patching](#patching)
* [Verifying that some exception is thrown](#verifying-that-some-exception-is-thrown)
* [Checking what was printed and logged to stdout or stderr by the tested code](#checking-what-was-printed-and-logged-to-stdout-or-stderr-by-the-tested-code)
* [Code style](#code-style)
* [Docstrings style](#docstrings-style)

Expand All @@ -34,7 +29,7 @@
5. Submit PR from your fork to main branch of the project repo


## Prerequisities
## Prerequisites

- git
- Python 3.12 or 3.13
Expand Down
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Installation steps depends on operation system. Please look at instructions for

# Configuration



## Integration with Llama Stack

The Llama Stack can be run as a standalone server and accessed via its the REST
Expand All @@ -82,9 +84,11 @@ many applications.

![Integration with Llama Stack](docs/core2llama-stack_interface.png)



## Llama Stack as separate server

If Llama Stack runs as a separate server, the Lightspeed service needs to be configured to be able to access it. For example, if server runs on localhost:8321, the service configuration should look like:
If Llama Stack runs as a separate server, the Lightspeed service needs to be configured to be able to access it. For example, if server runs on localhost:8321, the service configuration stored in file `llama-stack.yaml` should look like:

```yaml
name: foo bar baz
Expand All @@ -105,6 +109,60 @@ user_data_collection:
transcripts_storage: "/tmp/data/transcripts"
```

### Llama Stack project and configuration

To run Llama Stack in separate process, you need to have all dependencies installed. The easiest way how to do it is to create a separate repository with Llama Stack project file `pyproject.toml` and Llama Stack configuration file `run.yaml`. The project file might look like:

```toml
[project]
name = "llama-stack-runner"
version = "0.1.0"
description = "Llama Stack runner"
authors = []
dependencies = [
"llama-stack==0.2.14",
"fastapi>=0.115.12",
"opentelemetry-sdk>=1.34.0",
"opentelemetry-exporter-otlp>=1.34.0",
"opentelemetry-instrumentation>=0.55b0",
"aiosqlite>=0.21.0",
"litellm>=1.72.1",
"uvicorn>=0.34.3",
"blobfile>=3.0.0",
"datasets>=3.6.0",
"sqlalchemy>=2.0.41",
"faiss-cpu>=1.11.0",
"mcp>=1.9.4",
"autoevals>=0.0.129",
"psutil>=7.0.0",
"torch>=2.7.1",
"peft>=0.15.2",
"trl>=0.18.2"]
requires-python = "==3.12.*"
readme = "README.md"
license = {text = "MIT"}


[tool.pdm]
distribution = false
```

To run Llama Stack perform these two commands:

```
export OPENAI_API_KEY="sk-{YOUR-KEY}"

uv run llama stack run run.yaml
```

### Check connection to Llama Stack

```
curl -X 'GET' localhost:8321/openapi.json | jq .
```



## Llama Stack as client library

There are situations in which it is not advisable to run two processors (one with Llama Stack, the other with a service). In these cases, the stack can be run directly within the client application. For such situations, the configuration file could look like:
Expand Down
5 changes: 4 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# GitHub pages
# Lightspeed-Stack Documentation

Welcome. This directory is published via GitHub Pages.
See the full documentation at [`../README.md`](../README.md) or browse sub-pages in `docs/`.
41 changes: 39 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Testing

<!-- vim-markdown-toc GFM -->

* [Running tests](#running-tests)
* [Run all tests](#run-all-tests)
* [Select one group of tests](#select-one-group-of-tests)
* [Select individual test or group of tests to be run](#select-individual-test-or-group-of-tests-to-be-run)
Comment on lines +5 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix MD007 list-indent violations in the TOC

The second-level bullets are indented with four spaces instead of two, triggering markdownlint warnings and producing slightly off alignment in some renderers.

-* [Running tests](#running-tests)
-    * [Run all tests](#run-all-tests)
-    * [Select one group of tests](#select-one-group-of-tests)
-    * [Select individual test or group of tests to be run](#select-individual-test-or-group-of-tests-to-be-run)
+* [Running tests](#running-tests)
+  * [Run all tests](#run-all-tests)
+  * [Select one group of tests](#select-one-group-of-tests)
+  * [Select individual test or group of tests to be run](#select-individual-test-or-group-of-tests-to-be-run)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* [Running tests](#running-tests)
* [Run all tests](#run-all-tests)
* [Select one group of tests](#select-one-group-of-tests)
* [Select individual test or group of tests to be run](#select-individual-test-or-group-of-tests-to-be-run)
* [Running tests](#running-tests)
* [Run all tests](#run-all-tests)
* [Select one group of tests](#select-one-group-of-tests)
* [Select individual test or group of tests to be run](#select-individual-test-or-group-of-tests-to-be-run)
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

6-6: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


7-7: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


8-8: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

🤖 Prompt for AI Agents
In docs/testing.md around lines 5 to 8, the second-level bullet points in the
table of contents are indented with four spaces instead of the recommended two
spaces, causing markdownlint MD007 list-indent violations. Fix this by reducing
the indentation of these second-level bullets from four spaces to two spaces to
ensure proper alignment and compliance with markdownlint rules.

* [Unit tests](#unit-tests)
* [Unit tests structure](#unit-tests-structure)
* [Integration tests](#integration-tests)
* [End to end tests](#end-to-end-tests)
* [Tips and hints](#tips-and-hints)
* [Developing unit tests](#developing-unit-tests)
* [Patching](#patching)
* [Verifying that some exception is thrown](#verifying-that-some-exception-is-thrown)
* [Checking what was printed and logged to stdout or stderr by the tested code](#checking-what-was-printed-and-logged-to-stdout-or-stderr-by-the-tested-code)

<!-- vim-markdown-toc -->

Three groups of software tests are used in this repository, each group from the test suite having different granularity. These groups are designed to represent three layers:

1. Unit Tests
Expand All @@ -10,22 +28,39 @@ Three groups of software tests are used in this repository, each group from the

## Running tests

### Run all tests

Unit tests followed by integration and end to end tests can be started by using the following command:

```
```bash
make test
```

### Select one group of tests

It is also possible to run just one selected group of tests:

```
```bash
make test-unit Run the unit tests
make test-integration Run integration tests tests
make test-e2e Run end to end tests
Comment on lines +43 to 46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Duplicate word “tests” in integration command description

make test-integration Run integration tests tests repeats the word “tests”.

-make test-integration          Run integration tests tests
+make test-integration          Run integration tests
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```bash
make test-unit Run the unit tests
make test-integration Run integration tests tests
make test-e2e Run end to end tests
🤖 Prompt for AI Agents
In docs/testing.md around lines 43 to 46, the description for the integration
test command contains a duplicate word "tests". Remove the extra "tests" so the
line reads: "make test-integration          Run integration tests".

```



### Select individual test or group of tests to be run

```bash
uv run python -m pytest -vv tests/unit/utils/
```

Or, if you prefer to see coverage information, use following command:

```bash
uv run python -m pytest -vv tests/unit/utils/ --cov=src/utils/ --cov-report term-missing
```


## Unit tests

Unit tests are based on the [Pytest framework](https://docs.pytest.org/en/) and code coverage is measured by the plugin [pytest-cov](https://github.com/pytest-dev/pytest-cov). For mocking and patching, the [unittest framework](https://docs.python.org/3/library/unittest.html) is used.
Expand All @@ -34,6 +69,8 @@ Currently code coverage threshold for integration tests is set to 60%. This valu

As specified in Definition of Done, new changes need to be covered by tests.



### Unit tests structure

* Defined in [tests/unit](https://github.com/lightspeed-core/lightspeed-stack/tree/main/tests/unit)
Expand Down