You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 13_sandboxes/test_case_generator.py
+25-22Lines changed: 25 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,17 @@
4
4
# ---
5
5
6
6
# # LLM-Generated Unit Test Development
7
-
#
7
+
8
8
# Unit tests can become tedious to generate and maintain. While LLMs are a useful tool
9
9
# for generating test cases, hallucinations are always possible, making the code
10
10
# potentially unsafe to run locally.
11
11
#
12
12
# In this example, we'll show you how to generate unit tests in a [sample repository](https://github.com/modal-labs/password-analyzer) using an open-source LLM,
13
13
# and then run them in Modal Sandboxes - our sandboxed environment. We'll then open ports
14
14
# on each of our Sandboxes, showing the code diff and new test case coverage.
15
-
#
15
+
16
16
# # Model Setup
17
-
#
17
+
18
18
# First, let's pick an LLM to do the heavy lifting. We went with [deepseek-coder-6.7b-instruct](https://huggingface.co/deepseek-ai/deepseek-coder-6.7b-instruct)
19
19
# which offers a good trade-off between size and quality. At just 7B parameters, it ranks 9th on Hugging Face's
20
20
# [Big Code Models Leaderboard](https://huggingface.co/spaces/bigcode/bigcode-models-leaderboard), only beat out primarily by larger models.
# Now that our server is set up, let's create a client. We [parametrize](https://modal.com/docs/guide/parametrized-functions#using-parametrized-functions-with-lifecycle-functions) our function with
112
107
# the server `url`, which we'll pass in later. We'll add a [`@modal.method()`](https://modal.com/docs/reference/modal.method#modalmethod) decorator
113
108
# to register our `generate()` function as a Modal Function. Finally, we can invoke our OpenAI-compatible server with our prompt
0 commit comments