Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Add a regression test for the embedding (#3422)

James Collins94dc6f19aac6
diff --git a/tests/integration/test_llm_utils.py b/tests/integration/test_llm_utils.py
new file mode 100644
index 0000000000..7f312bde19
--- /dev/null
+++ b/tests/integration/test_llm_utils.py
@@ -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
+
+
[email protected](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))
+
+
[email protected](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)