MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / execute

Method execute

camel/prompts/base.py:168–201  ·  view source on GitHub ↗

r"""Executes the code string using the provided interpreter. This method runs a code string through either a specified interpreter or a default one. It supports additional keyword arguments for flexibility. Args: interpreter (Optional[BaseInterpreter]):

(
        self,
        interpreter: Optional[BaseInterpreter] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

166 self._code_type = code_type
167
168 def execute(
169 self,
170 interpreter: Optional[BaseInterpreter] = None,
171 **kwargs: Any,
172 ) -> str:
173 r"""Executes the code string using the provided interpreter.
174
175 This method runs a code string through either a specified interpreter
176 or a default one. It supports additional keyword arguments for
177 flexibility.
178
179 Args:
180 interpreter (Optional[BaseInterpreter]): The interpreter instance
181 to use for execution. If `None`, a default interpreter is used.
182 (default: :obj:`None`)
183 **kwargs: Additional keyword arguments passed to the interpreter to
184 run the code.
185
186 Returns:
187 str: The result of the code execution. If the execution fails, this
188 should include sufficient information to diagnose and correct
189 the issue.
190
191 Raises:
192 InterpreterError: If the code execution encounters errors that
193 could be resolved by modifying or regenerating the code.
194 """
195 if interpreter is None:
196 execution_res = SubprocessInterpreter().run(
197 self, self._code_type, **kwargs
198 )
199 else:
200 execution_res = interpreter.run(self, self._code_type, **kwargs)
201 return execution_res
202
203
204# flake8: noqa :E501

Callers 6

_get_sessionMethod · 0.45
queryMethod · 0.45
initMethod · 0.45
saveMethod · 0.45
find_by_guildMethod · 0.45
deleteMethod · 0.45

Calls 2

runMethod · 0.45

Tested by

no test coverage detected