-
-
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.
- Loading branch information
1 parent
26362c7
commit 5e3b175
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