Remove dependence on os.environ["USER"]

This commit is contained in:
Ashwin Bharambe 2024-09-05 15:37:12 -07:00
parent 6c69e09c6a
commit f6b5e394ab
2 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@
import logging import logging
import os import tempfile
import uuid import uuid
from typing import AsyncGenerator from typing import AsyncGenerator
@ -71,7 +71,7 @@ class MetaReferenceAgenticSystemImpl(AgenticSystem):
tool = CodeInterpreterTool() tool = CodeInterpreterTool()
elif isinstance(tool_defn, PhotogenToolDefinition): elif isinstance(tool_defn, PhotogenToolDefinition):
tool = PhotogenTool( tool = PhotogenTool(
dump_dir="/tmp/photogen_dump_" + os.environ["USER"], dump_dir=tempfile.mkdtemp(),
) )
else: else:
continue continue

View file

@ -5,8 +5,8 @@
# the root directory of this source tree. # the root directory of this source tree.
import json import json
import os
import re import re
import tempfile
from abc import abstractmethod from abc import abstractmethod
from typing import List, Optional from typing import List, Optional
@ -284,7 +284,7 @@ class WolframAlphaTool(SingleMessageBuiltinTool):
class CodeInterpreterTool(BaseTool): class CodeInterpreterTool(BaseTool):
def __init__(self) -> None: def __init__(self) -> None:
ctx = CodeExecutionContext( ctx = CodeExecutionContext(
matplotlib_dump_dir=f"/tmp/{os.environ['USER']}_matplotlib_dump", matplotlib_dump_dir=tempfile.mkdtemp(),
) )
self.code_executor = CodeExecutor(ctx) self.code_executor = CodeExecutor(ctx)