Repository navigation
Deprecate CodeAct and ProgramOfThought #10198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import inspect | ||
| import logging | ||
| import warnings | ||
| from typing import Callable | ||
|
|
||
| import dspy | ||
|
|
@@ -12,8 +13,12 @@ | |
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class CodeAct(ReAct, ProgramOfThought): | ||
| """ | ||
| .. deprecated:: 3.5 | ||
| CodeAct is deprecated. RLM is the preferred replacement. | ||
|
Comment on lines
+19
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This release is version 3.3.0, but the directive says 3.4. Generated API documentation will therefore tell users that CodeAct was deprecated in a later release than the one that actually introduced the deprecation. Update this directive and the matching directive in ArtifactsDeprecation directive check script
Directive versions before clarification
Release metadata at introduction
Release metadata at current PR
|
||
|
|
||
| CodeAct is a module that utilizes the Code Interpreter and predefined tools to solve the problem. | ||
| """ | ||
|
|
||
|
|
@@ -45,15 +50,18 @@ def factorial(n): | |
| act(n=5) # 120 | ||
| ``` | ||
| """ | ||
| warnings.warn( | ||
| "CodeAct is deprecated and will be removed in 3.5. RLM is the preferred replacement.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
| _validate_interpreter_factory(interpreter_factory) | ||
| self.signature = ensure_signature(signature) | ||
| self.max_iters = max_iters | ||
| self.history = [] | ||
|
|
||
| tools = [t if isinstance(t, Tool) else Tool(t) for t in tools] | ||
| if any( | ||
| not inspect.isfunction(tool.func) for tool in tools | ||
| ): | ||
| if any(not inspect.isfunction(tool.func) for tool in tools): | ||
| raise ValueError("CodeAct only accepts functions and not callable objects.") | ||
| tools = {tool.name: tool for tool in tools} | ||
|
|
||
|
|
@@ -62,7 +70,13 @@ def factorial(n): | |
| codeact_signature = ( | ||
| dspy.Signature({**self.signature.input_fields}, "\n".join(instructions)) | ||
| .append("trajectory", dspy.InputField(), type_=str) | ||
| .append("generated_code", dspy.OutputField(desc="Python code that when executed, produces output relevant to answering the question"), type_=str) | ||
| .append( | ||
| "generated_code", | ||
| dspy.OutputField( | ||
| desc="Python code that when executed, produces output relevant to answering the question" | ||
| ), | ||
| type_=str, | ||
| ) | ||
| .append("finished", dspy.OutputField(desc="a boolean flag to determine if the process is done"), type_=bool) | ||
| ) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.