-
Notifications
You must be signed in to change notification settings - Fork 6
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
24887f1
commit f55b162
Showing
23 changed files
with
192 additions
and
276 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 was deleted.
Oops, something went wrong.
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,30 @@ | ||
from typing import Optional | ||
from pydantic import BaseModel | ||
from intelligence_layer.core.model import AlephAlphaModel, CompleteInput, CompleteOutput | ||
|
||
from intelligence_layer.core.task import Task | ||
from intelligence_layer.core.tracer import TaskSpan | ||
|
||
|
||
class InstructInput(BaseModel): | ||
instruction: str | ||
input: Optional[str] = None | ||
response_prefix: Optional[str] = None | ||
maximum_tokens: int = 128 | ||
|
||
|
||
class Instruct(Task[InstructInput, CompleteOutput]): | ||
def __init__(self, model: AlephAlphaModel) -> None: | ||
super().__init__() | ||
self._model = model | ||
|
||
def do_run(self, input: InstructInput, task_span: TaskSpan) -> CompleteOutput: | ||
prompt = self._model.to_instruct_prompt( | ||
instruction=input.instruction, | ||
input=input.input, | ||
response_prefix=input.response_prefix | ||
) | ||
return self._model.complete(CompleteInput( | ||
prompt=prompt, | ||
maximum_tokens=input.maximum_tokens | ||
), task_span) |
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
Oops, something went wrong.