Run online, offine chat actor, director tests for any supported provider

- Previously online chat actors, director tests only worked with openai.
  This change allows running them for any supported onlnie provider
  including Google, Anthropic and Openai.

- Enable online/offline chat actor, director in two ways:
  1. Explicitly setting KHOJ_TEST_CHAT_PROVIDER environment variable to
     google, anthropic, openai, offline
  2. Implicitly by the first API key found from openai, google or anthropic.

- Default offline chat provider to use Llama 3.1 3B for faster, lower
  compute test runs
This commit is contained in:
Debanjum
2024-11-18 14:19:09 -08:00
parent 653127bf1d
commit 2a76c69d0d
6 changed files with 64 additions and 27 deletions

View File

@@ -2,7 +2,10 @@ from datetime import datetime
import pytest
SKIP_TESTS = True
from khoj.database.models import ChatModelOptions
from tests.helpers import get_chat_provider
SKIP_TESTS = get_chat_provider(default=None) != ChatModelOptions.ModelType.OFFLINE
pytestmark = pytest.mark.skipif(
SKIP_TESTS,
reason="Disable in CI to avoid long test runs.",