Skip to content

Commit 051749b

Browse files
committed
Added jupyter-ai-litellm pkg, removed related code
1 parent 7a7003e commit 051749b

File tree

6 files changed

+7
-73
lines changed

6 files changed

+7
-73
lines changed

jupyter_ai_jupyternaut/extension_app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .config import ConfigManager, ConfigRestAPI
1212
from .handlers import RouteHandler
1313
from .jupyternaut import JupyternautPersona
14-
from .models import ChatModelsRestAPI, ModelParametersRestAPI
14+
from .models import ModelParametersRestAPI
1515
from .secrets import EnvSecretsManager, SecretsRestAPI
1616

1717
if TYPE_CHECKING:
@@ -38,7 +38,6 @@ class JupyternautExtension(ExtensionApp):
3838
handlers = [
3939
(r"api/jupyternaut/get-example/?", RouteHandler),
4040
(r"api/jupyternaut/config/?", ConfigRestAPI),
41-
(r"api/jupyternaut/models/chat/?", ChatModelsRestAPI),
4241
(r"api/jupyternaut/model-parameters/?", ModelParametersRestAPI),
4342
(r"api/jupyternaut/secrets/?", SecretsRestAPI),
4443
(
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from .model_list import CHAT_MODELS, EMBEDDING_MODELS
2-
from .chat_models_rest_api import ChatModelsRestAPI
31
from .parameters_rest_api import ModelParametersRestAPI

jupyter_ai_jupyternaut/models/chat_models_rest_api.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

jupyter_ai_jupyternaut/models/model_list.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies = [
3838
# NOTE: Make sure to update the corresponding dependency in
3939
# `packages/jupyter-ai/package.json` to match the version range below
4040
"jupyterlab-chat>=0.17.0,<0.18.0",
41-
"litellm>=1.73,<2",
41+
"jupyter_ai_litellm>=0.0.1",
4242
"jinja2>=3.0,<4",
4343
"python_dotenv>=1,<2",
4444
"jupyter_ai_persona_manager>=0.0.1",

src/handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ const API_NAMESPACE = 'api/jupyternaut';
99
*
1010
* @param endPoint API REST end point for the extension
1111
* @param init Initial values for the request
12+
* @param api_namespace Optional API namespace (defaults to API_NAMESPACE)
1213
* @returns The response body interpreted as JSON
1314
*/
1415
export async function requestAPI<T>(
1516
endPoint = '',
16-
init: RequestInit = {}
17+
init: RequestInit = {},
18+
api_namespace: string = API_NAMESPACE
1719
): Promise<T> {
1820
// Make request to Jupyter API
1921
const settings = ServerConnection.makeSettings();
20-
const requestUrl = URLExt.join(settings.baseUrl, API_NAMESPACE, endPoint);
22+
const requestUrl = URLExt.join(settings.baseUrl, api_namespace, endPoint);
2123

2224
let response: Response;
2325
try {
@@ -169,7 +171,7 @@ export namespace AiService {
169171
export async function listChatModels(): Promise<string[]> {
170172
const response = await requestAPI<ListChatModelsResponse>('models/chat/', {
171173
method: 'GET'
172-
});
174+
}, 'api/ai');
173175
return response.chat_models;
174176
}
175177

0 commit comments

Comments
 (0)