-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #585 from reworkd/code
💻 Add code writer tool
- Loading branch information
Showing
7 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from langchain import LLMChain | ||
|
||
from reworkd_platform.web.api.agent.model_settings import ModelSettings, create_model | ||
from reworkd_platform.web.api.agent.prompts import code_prompt | ||
from reworkd_platform.web.api.agent.tools.tool import Tool | ||
|
||
|
||
class Code(Tool): | ||
description = ( | ||
"Useful for writing, reviewing, and refactoring code. Can also fix bugs, " | ||
"and explain programming concepts." | ||
) | ||
public_description = "Write and review code." | ||
|
||
def __init__(self, model_settings: ModelSettings): | ||
super().__init__(model_settings) | ||
|
||
async def call(self, goal: str, task: str, input_str: str) -> str: | ||
llm = create_model(self.model_settings) | ||
chain = LLMChain(llm=llm, prompt=code_prompt) | ||
|
||
return await chain.arun({"goal": goal, "language": "English", "task": task}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
781e835
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-git-main-reworkd.vercel.app
docs-reworkd.vercel.app
docs.reworkd.ai