-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
30 changed files
with
257 additions
and
197 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
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 |
---|---|---|
@@ -1,9 +1,35 @@ | ||
from abc import ABC, abstractmethod | ||
from dataclasses import dataclass | ||
|
||
from .prompt import BasePromptValue | ||
|
||
|
||
@dataclass(frozen=True) | ||
class Response: | ||
"""A class representing a response from a target. | ||
Attributes: | ||
content (str): The content of the response. | ||
""" | ||
|
||
content: str | ||
|
||
def __repr__(self) -> str: | ||
"""Return a string representation of the Response.""" | ||
return f"content={repr(self.content)}" | ||
|
||
|
||
class BaseTarget(ABC): | ||
"""An abstract base class for targets.""" | ||
|
||
@abstractmethod | ||
def send_prompt(self, prompt: BasePromptValue) -> str: | ||
def send_prompt(self, prompt: BasePromptValue) -> Response: | ||
"""Send a prompt to the target and return the response. | ||
Args: | ||
prompt (BasePromptValue): The prompt to send. | ||
Returns: | ||
Response: The response from the target. | ||
""" | ||
pass |
Oops, something went wrong.