@@ -74,7 +74,7 @@ print(result.stdout)
7474
7575``` python
7676import judge0
77- result = judge0.run(source_code = " print('hello, world')" )
77+ result = judge0.run(source_code = " print('hello, world')" , language = judge0. PYTHON )
7878print (result.stdout)
7979```
8080
@@ -233,7 +233,7 @@ print(client.get_languages())
233233
234234### Running LLM-Generated Code
235235
236- #### Simple
236+ #### Simple Example with Ollama
237237
238238``` python
239239import os
@@ -264,7 +264,7 @@ result = judge0.run(source_code=code, language=judge0.PYTHON)
264264print (f " Execution result: \n { result.stdout} " )
265265```
266266
267- #### Tool Calling (a.k.a. Function Calling)
267+ #### Tool Calling (a.k.a. Function Calling) with Ollama
268268
269269``` python
270270import os
@@ -319,3 +319,38 @@ if response_message.tool_calls:
319319final_response = client.chat(model = model, messages = messages)
320320print (final_response[" message" ][" content" ])
321321```
322+
323+ ### Filesystem
324+
325+ ``` python
326+ import judge0
327+ from judge0 import Filesystem, File, Submission
328+
329+ fs = Filesystem(
330+ content = [
331+ File(name = " ./my_dir1/my_file1.txt" , content = " hello from my_file.txt" ),
332+ ]
333+ )
334+
335+ source_code = """
336+ cat ./my_dir1/my_file1.txt
337+
338+ mkdir my_dir2
339+ echo "hello, world" > ./my_dir2/my_file2.txt
340+ """
341+
342+ submission = Submission(
343+ source_code = source_code,
344+ language = judge0.BASH ,
345+ additional_files = fs,
346+ )
347+
348+ result = judge0.run(submissions = submission)
349+ fs = Filesystem(content = result.post_execution_filesystem)
350+
351+ print (result.stdout)
352+
353+ matches = [f for f in fs if f.name == " my_dir2/my_file2.txt" ]
354+ f = matches[0 ] if matches else None
355+ print (f)
356+ ```
0 commit comments