-
Notifications
You must be signed in to change notification settings - Fork 57
feat: integrate new genvm #599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
096b1e8
Integrate new genvm
kp2pml30 1fe8c32
hotfix for failed CI tests
kp2pml30 70969d4
rename constructor parameters
kp2pml30 d377c99
add genvm fetching with github token
kp2pml30 35068a8
fix aarch64 issues and other minor bugs
kp2pml30 9539ce0
minor updates addressing feedback
kp2pml30 b25162c
add docs, cleanup code
kp2pml30 9920b93
fix for aarch64, update genvm to v0.0.6
kp2pml30 ae568c7
fix a couple of bugs
kp2pml30 3c64c71
add hello world example, fix consensus, fix typing bug in endpoints t…
kp2pml30 7cb2595
minor review related improvements
kp2pml30 3eecf62
Merge branch 'main' into integrate-genvm
cristiam86 f67eaed
increase reliability of detection of contract deployments on tx updates
0679a3e
add call button loading state
ecd5cfb
fix error in tests inroduced by Den's commit
kp2pml30 795ceb4
fix routes in e2e tests
8669c7b
fix contract address mapping in deployment tx/unit test
b81bbce
fix integration tests - add migration to drop not null constraint on …
0d0257b
fix precommit formatting
c374d0c
Merge commit 'refs/pull/624/head' of github.com:yeagerai/genlayer-sim…
kp2pml30 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,70 @@ | ||
| import asyncio | ||
| import aiohttp | ||
| from typing import Protocol, Any | ||
| import os | ||
| import json | ||
|
|
||
| _webrequest_url: str = ( | ||
| os.environ["WEBREQUESTPROTOCOL"] | ||
| + "://" | ||
| + os.environ["WEBREQUESTHOST"] | ||
| + ":" | ||
| + os.environ["WEBREQUESTPORT"] | ||
| ) | ||
|
|
||
|
|
||
| class Plugin(Protocol): | ||
| def __init__(self, plugin_config: dict): ... | ||
|
|
||
| async def call( | ||
| self, | ||
| node_config: dict, | ||
| prompt: str, | ||
| regex: str | None, | ||
| ) -> str: ... | ||
|
|
||
| async def is_available(self) -> bool: ... | ||
|
|
||
| async def is_model_available(self, model: str) -> bool: ... | ||
|
|
||
|
|
||
| async def _call_jsonrpc(function_name: str, *args) -> Any: | ||
| payload = { | ||
| "jsonrpc": "2.0", | ||
| "method": function_name, | ||
| "params": [*args], | ||
| "id": 1, | ||
| } | ||
| async with aiohttp.ClientSession() as session: | ||
| async with session.post( | ||
| _webrequest_url + "/api", | ||
| data=json.dumps(payload), | ||
| headers={"Content-Type": "application/json"}, | ||
| ) as response: | ||
| res = json.loads(await response.text()) | ||
| return res["result"]["response"] | ||
|
|
||
|
|
||
| class _RemotePlugin(Plugin): | ||
| def __init__(self, id: str): | ||
| self._id = id | ||
|
|
||
| async def call( | ||
| self, | ||
| node_config: dict, | ||
| prompt: str, | ||
| regex: str | None, | ||
| ) -> str: | ||
| return await _call_jsonrpc( | ||
| "llm_plugin_call", self._id, node_config, prompt, regex | ||
| ) | ||
|
|
||
| async def is_available(self) -> bool: | ||
| return await _call_jsonrpc("llm_plugin_is_available", self._id) | ||
|
|
||
| async def is_model_available(self, model: str) -> bool: | ||
| return await _call_jsonrpc("llm_plugin_is_model_available", self._id, model) | ||
|
|
||
|
|
||
| async def get_llm_plugin(plugin: str, plugin_config: dict) -> Plugin: | ||
| return _RemotePlugin(await _call_jsonrpc("llm_plugin_get", plugin, plugin_config)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.