diff --git a/docs/building-with-codegen/calling-out-to-llms.mdx b/docs/building-with-codegen/calling-out-to-llms.mdx index 0c0a8e179..2af46600a 100644 --- a/docs/building-with-codegen/calling-out-to-llms.mdx +++ b/docs/building-with-codegen/calling-out-to-llms.mdx @@ -225,3 +225,10 @@ method.edit(new_impl) ```python codebase.set_session_options(max_ai_requests=200) ``` +< +Note> + You can also use `codebase.set_session_options` to increase the execution time and the number of operations allowed in a session. This is useful for handling larger tasks or more complex operations that require additional resources. Adjust the `max_seconds` and `max_transactions` parameters to suit your needs: + ```python + codebase.set_session_options(max_seconds=300, max_transactions=500) + ``` + \ No newline at end of file diff --git a/src/codegen/sdk/core/codebase.py b/src/codegen/sdk/core/codebase.py index 232ace1bb..701d4d568 100644 --- a/src/codegen/sdk/core/codebase.py +++ b/src/codegen/sdk/core/codebase.py @@ -1117,7 +1117,21 @@ def find_by_span(self, span: Span) -> list[Editable]: return [] def set_session_options(self, **kwargs: Unpack[SessionOptions]) -> None: - """Sets the Session options for the current codebase.""" + """Sets the session options for the current codebase. + + This method updates the session options with the provided keyword arguments and + configures the transaction manager accordingly. It sets the maximum number of + transactions and resets the stopwatch based on the updated session options. + + Args: + **kwargs: Keyword arguments representing the session options to update. + - max_transactions (int, optional): The maximum number of transactions + allowed in a session. + - max_seconds (int, optional): The maximum duration in seconds for a session + before it times out. + - max_ai_requests (int, optional): The maximum number of AI requests + allowed in a session. + """ self.G.session_options = self.G.session_options.model_copy(update=kwargs) self.G.transaction_manager.set_max_transactions(self.G.session_options.max_transactions) self.G.transaction_manager.reset_stopwatch(self.G.session_options.max_seconds)