mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-20 23:44:19 +01:00
Add a regression test for the embedding (#3422)
This commit is contained in:
25
tests/integration/test_llm_utils.py
Normal file
25
tests/integration/test_llm_utils.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import string
|
||||
|
||||
import pytest
|
||||
from numpy.random import RandomState
|
||||
|
||||
from autogpt.llm_utils import get_ada_embedding
|
||||
from tests.utils import requires_api_key
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def random_large_string():
|
||||
"""Big string used to overwhelm token limits."""
|
||||
seed = 42
|
||||
n_characters = 30_000
|
||||
random = RandomState(seed)
|
||||
return "".join(random.choice(list(string.ascii_lowercase), size=n_characters))
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="We have no mechanism for embedding large strings.")
|
||||
@requires_api_key("OPENAI_API_KEY")
|
||||
def test_get_ada_embedding_large_context(random_large_string):
|
||||
# This test should be able to mock the openai call after we have a fix. We don't need
|
||||
# to hit the API to test the logic of the function (so not using vcr). This is a quick
|
||||
# regression test to document the issue.
|
||||
get_ada_embedding(random_large_string)
|
||||
Reference in New Issue
Block a user