-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a mock runtime and a mock test for counter
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from runtime import BaseRuntime | ||
from provider import BaseLLMProvider | ||
from parse_metaprompt import parse_metaprompt | ||
|
||
from typing import AsyncGenerator, List | ||
import os | ||
|
||
class MockRuntime(BaseRuntime): | ||
def __init__(self, modules): | ||
# TODO: implement relative module loading in the mock | ||
self.modules = modules | ||
|
||
def set_status(self, status: str): | ||
self.status = status | ||
|
||
def load_module(self, module_name: str): | ||
if module_name in self.modules: | ||
return parse_metaprompt(self.modules[module_name]) | ||
|
||
raise ImportError( | ||
f"Module {module_name} not found" | ||
) | ||
|
||
def print_chunk(self, chunk: str): | ||
pass | ||
|
||
def input(self, prompt): | ||
pass # TODO: implement | ||
|
||
def finalize(self): | ||
pass |
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