Skip to content

Commit 0a76ec1

Browse files
Ft/jupyter server (#35)
* chore: add server handlers * bump: package.json * chore: handlers * fix * dep: add jupyter-server * Automatic application of license header --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent a93dff9 commit 0a76ec1

File tree

29 files changed

+701
-152
lines changed

29 files changed

+701
-152
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jupyterlab: ## jupyterlab
3232
jupyter lab \
3333
--port 8888 \
3434
--ServerApp.root_dir ./dev/content \
35-
--IdentityProvider.token MY_TOKEN
35+
--IdentityProvider.token=
3636

3737
server: ## server
3838
@exec echo
3939
@exec echo open http://localhost:4400/api/ai-agents/v1/ping
4040
@exec echo
41-
python -m uvicorn jupyter_ai_agents.datalayer.server:app --reload --port 4400
41+
python -m uvicorn jupyter_ai_agents.server.main:main --reload --port 4400
4242

4343
prompt:
4444
jupyter-ai-agents prompt \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ pip uninstall jupyter_ai_agents
143143

144144
## Deploy in a Server
145145

146-
You can start a Jupyter AI Agents server to be used in combination with the [Datalayer service](https://datalayer.io).
146+
You can start a Jupyter AI Agents server to be used in combination with the [Datalayer online services](https://datalayer.app).
147147

148148
```bash
149-
make start
149+
make server
150150
```
151151

152152
## Contributing

dev/content/test.ipynb

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,32 @@
33
{
44
"cell_type": "code",
55
"execution_count": null,
6-
"metadata": {},
6+
"id": "fac937b5-6be5-415f-9c4f-d0511508955a",
7+
"metadata": {
8+
"datalayer": {
9+
"ai": {
10+
"prompts": [
11+
{
12+
"id": "01JRJ8Y2KF9QCQZTXQT8FJH",
13+
"prompt": "create a plot",
14+
"timestamp": 1744370076271,
15+
"username": null
16+
},
17+
{
18+
"id": "01JRJ8Y2KF9QCQZTXJH",
19+
"prompt": "create a matplot",
20+
"timestamp": 1744370076271,
21+
"username": null
22+
}
23+
]
24+
}
25+
},
26+
"editable": true,
27+
"slideshow": {
28+
"slide_type": ""
29+
},
30+
"tags": []
31+
},
732
"outputs": [],
833
"source": []
934
}
@@ -28,5 +53,5 @@
2853
}
2954
},
3055
"nbformat": 4,
31-
"nbformat_minor": 2
56+
"nbformat_minor": 5
3257
}

docs/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
},
1616
"dependencies": {
1717
"@datalayer/icons-react": "^1.0.0",
18-
"@datalayer/primer-addons": "^0.3.1",
19-
"@docusaurus/core": "3.5.2",
20-
"@docusaurus/preset-classic": "3.5.2",
21-
"@docusaurus/theme-live-codeblock": "3.5.2",
22-
"@docusaurus/theme-mermaid": "3.5.2",
18+
"@datalayer/primer-addons": "^1.0.0",
19+
"@docusaurus/core": "^3.5.2",
20+
"@docusaurus/preset-classic": "^3.5.2",
21+
"@docusaurus/theme-live-codeblock": "^3.5.2",
22+
"@docusaurus/theme-mermaid": "^3.5.2",
2323
"@mdx-js/react": "^3.0.1",
2424
"clsx": "^2.1.1",
25-
"docusaurus-lunr-search": "3.5.0",
26-
"react": "18.2.0",
27-
"react-calendly": "4.1.0",
28-
"react-dom": "18.2.0",
29-
"react-modal-image": "2.6.0"
25+
"docusaurus-lunr-search": "^3.5.0",
26+
"react": "18.3.1",
27+
"react-calendly": "^4.1.0",
28+
"react-dom": "18.3.1",
29+
"react-modal-image": "^2.6.0"
3030
},
3131
"browserslist": {
3232
"production": [
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"NotebookApp": {
3+
"nbserver_extensions": {
4+
"jupyter_ai_agents": true
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ServerApp": {
3+
"jpserver_extensions": {
4+
"jupyter_ai_agents": true
5+
}
6+
}
7+
}

jupyter_ai_agents/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,17 @@
44

55
"""Jupyter AI Agents."""
66

7+
from typing import Any, Dict, List
8+
9+
from jupyter_ai_agents.__version__ import __version__
10+
from jupyter_ai_agents.serverapplication import JupyterAIAgentsExtensionApp
11+
12+
713
__all__ = []
14+
15+
16+
def _jupyter_server_extension_points() -> List[Dict[str, Any]]:
17+
return [{
18+
"module": "jupyter_ai_agents",
19+
"app": JupyterAIAgentsExtensionApp,
20+
}]

jupyter_ai_agents/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
"""Jupyter AI Agents."""
66

7-
__version__ = "0.9.1"
7+
__version__ = "0.10.1"

jupyter_ai_agents/agents/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from jupyter_nbmodel_client import BaseNbAgent
1313
from jupyter_nbmodel_client.constants import REQUEST_TIMEOUT
1414

15+
1516
logger = logging.getLogger(__name__)
1617

1718

@@ -45,5 +46,3 @@ async def stop(self) -> None:
4546
await super().stop()
4647
if self._runtime_client:
4748
self._runtime_client.stop()
48-
49-

jupyter_ai_agents/agents/prompt.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ async def _on_user_prompt(
115115
"""
116116
document_client = self
117117
runtime_client = self.runtime_client
118-
119118
current_cell_index = self.get_cell_index(cell_id)
120-
121119
agent_executor = _create_agent(
122120
document_client,
123121
runtime_client,
@@ -126,9 +124,7 @@ async def _on_user_prompt(
126124
self.full_context,
127125
current_cell_index,
128126
)
129-
130127
output = None
131-
132128
try:
133129
await self.notify("Thinking…", cell_id=cell_id)
134130
async for reply in agent_executor.astream({"input": prompt}):

0 commit comments

Comments
 (0)