Skip to content

Commit

Permalink
Upgrade hypha and schema-agents
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Nov 14, 2024
1 parent c263504 commit 7562275
Show file tree
Hide file tree
Showing 8 changed files with 507 additions and 509 deletions.
6 changes: 2 additions & 4 deletions bioimageio_chatbot/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import secrets
import aiofiles
from functools import partial
from imjoy_rpc.hypha import login, connect_to_server
from hypha_rpc import login, connect_to_server

from pydantic import BaseModel, Field
from schema_agents import Role, Message
Expand Down Expand Up @@ -487,9 +487,7 @@ async def ping(context=None):
}
)

server_info = await server.get_connection_info()

await serve_actions(server, server_info.public_base_url, builtin_extensions)
await serve_actions(server, server.config.public_base_url, builtin_extensions)
server_url = server.config["public_base_url"]

service_id = hypha_service_info["id"]
Expand Down
2 changes: 1 addition & 1 deletion bioimageio_chatbot/gpts_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from openai import AsyncOpenAI
from bioimageio_chatbot.chatbot_extensions import extension_to_tools
from schema_agents.utils.schema_conversion import get_service_openapi_schema
from imjoy_rpc.hypha import login, connect_to_server
from hypha_rpc import login, connect_to_server

client = AsyncOpenAI()

Expand Down
8 changes: 4 additions & 4 deletions bioimageio_chatbot/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>

<!-- Latest compiled and minified JavaScript -->
<script src="https://unpkg.com/[email protected]/dist/multiple-select.min.js"></script>
<script src="https://www.unpkg.com/imjoy-rpc@0.5.46/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hypha-rpc@0.20.38/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://lib.imjoy.io/imjoy-loader.js"></script>
<script src="https://unpkg.com/[email protected]/lib/marked.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
Expand Down Expand Up @@ -741,7 +741,7 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
}

// this function is used to remove the __rpc_object__ attribute from the object
// this is important to make sure the function is correctly encoded and send to imjoy_rpc
// this is important to make sure the function is correctly encoded and send to hypha_rpc
function _removeRpcObj(obj) {
if (obj && obj.__rpc_object__) {
delete obj.__rpc_object__
Expand Down Expand Up @@ -1042,7 +1042,7 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
Assist users in bioimage analysis within a Pyodide environment.
You will generate and run script in the code interpreter to help users analyze their data.
The code interperter is a Jupyter notebook-like environment, it support top-level await operations and the asyncio event loop is already running, so you can call "await func()" directly without wrapping in a async function or using asyncio.run.
The environment has access to remote servers, so you can fetch remote data by using python modules "requests" or "imjoy_rpc.hypha" for connect to the Hypha/BioEngine server.
The environment has access to remote servers, so you can fetch remote data by using python modules "requests" or "hypha_rpc" for connect to the Hypha/BioEngine server.
User data will be mounted to the \`/mnt\` directory. After mounting, use "os.listdir('/mnt')" to explore available files and ask user what they want to do with the data before other actions.
The code interpreter can produce outputs such as stdout or stderr, matplotlib plots, and image/audio displays which is rendered in the user interface. For key results (e.g. result images), display them in the final response to the user.
Global variables, functions and results will be maintained across multiple code interpreter executions, so try to save the intermediate results into global variables that can be subsequently reused.
Expand Down Expand Up @@ -1401,7 +1401,7 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
"server_url": serverUrl,
"token": token,
})
const svc = await server.getService(service_id || "public/workspace-manager:bioimageio-chatbot")
const svc = await server.getService(service_id || "public/bioimageio-chatbot")
await svc.ping()
if(svc.version) $('#chatbot-version-badge').text(`bioimageio-chatbot ${svc.version}`);
const storeSvc = await server.registerService({
Expand Down
Loading

0 comments on commit 7562275

Please sign in to comment.