Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "lmsjs-schema/lmstudio.js"]
path = lmsjs-schema/lmstudio.js
[submodule "sdk-schema/lmstudio.js"]
path = sdk-schema/lmstudio.js
url = https://github.com/lmstudio-ai/lmstudio.js.git
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $ git clone https://github.com/lmstudio-ai/lmstudio-python
$ cd lmstudio-python
```

To be able to run `tox -e sync-lmsjs-schema`, it is also
To be able to run `tox -e sync-sdk-schema`, it is also
necessary to ensure the `lmstudio.js` submodule is updated:

```console
Expand Down Expand Up @@ -190,12 +190,12 @@ Additional notes on running and updating the tests can be found in the

### Expanding the API

- the content of `src/lmstudio/_lmsjs_models` is automatically generated by the
`sync-lmsjs-schema.py` script in `lmsjs-schema` and should not be modified directly.
Run `tox -e sync-lmsjs-schema` to regenerate the Python submodule from the existing
- the content of `src/lmstudio/_sdk_models` is automatically generated by the
`sync-sdk-schema.py` script in `sdk-schema` and should not be modified directly.
Run `tox -e sync-sdk-schema` to regenerate the Python submodule from the existing
export of the `lmstudio.js` schema (for example, after modifying the data model
template). Run `tox -e sync-lmsjs-schema -- --regen-schema` after updating the
`lmsjs-schema/lmstudio.js` submodule itself to a newer iteration of the
template). Run `tox -e sync-sdk-schema -- --regen-schema` after updating the
`sdk-schema/lmstudio.js` submodule itself to a newer iteration of the
`lmstudio.js` JSON API.
- as support for new API namespaces is added to the SDK, each should get a dedicated
session type (similar to those for the already supported namespaces), even if it
Expand Down
7 changes: 0 additions & 7 deletions lmsjs-schema/README.md

This file was deleted.

60 changes: 30 additions & 30 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"typing-extensions>=4.12.2",
]

# Keep this in sync with the target Python version in sync-lmsjs-schema.py
# Keep this in sync with the target Python version in sync-sdk-schema.py
requires-python = ">=3.11"

readme = "README.md"
Expand Down Expand Up @@ -71,7 +71,7 @@ dev = [
bootstrap = [
"pdm>=2.16.1",
]
sync-lmsjs-schema = [
sync-sdk-schema = [
# Needs https://github.com/koxudaxi/datamodel-code-generator/issues/2211 fix
"datamodel-code-generator[http]>=0.26.4",
]
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions sdk-schema/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lmstudio.js JSON Schema export
==============================

`tox -e sync-sdk-schema` runs `sync-sdk-schema.py` in
a suitably configured Python environment.

The generated models are written to `../src/lmstudio.js/_sdk_models/*.py`.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Uses `npm run zod-to-json-schema` to populate `./_json_schema`
# Uses https://github.com/koxudaxi/datamodel-code-generator/
# to emit Python data model classes for the defined JSON schemas
# to `../src/lmstudio/_lmsjs_models`
# to `../src/lmstudio/_sdk_models`


# * invokes `npm run build` and `npm run make-schemas` in the
Expand Down Expand Up @@ -48,7 +48,7 @@
_CACHED_SCHEMA_PATH = _THIS_DIR / _SCHEMA_PATH.name
_INFERRED_SCHEMA_PATH = _THIS_DIR / "lms-with-inferred-unions.json"
_TEMPLATE_DIR = _THIS_DIR / "_templates"
_MODEL_DIR = _THIS_DIR.parent / "src/lmstudio/_lmsjs_models"
_MODEL_DIR = _THIS_DIR.parent / "src/lmstudio/_sdk_models"
_MODEL_PATH = _MODEL_DIR / "__init__.py"

# The following schemas are not actually used anywhere,
Expand Down
2 changes: 1 addition & 1 deletion src/lmstudio/_kv_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from .sdk_api import LMStudioValueError
from .schemas import DictSchema, DictObject, ModelSchema
from ._lmsjs_models import (
from ._sdk_models import (
EmbeddingLoadModelConfig,
EmbeddingLoadModelConfigDict,
KvConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ These files should NOT be modified: if the messaging protocol details
change, updates should be made in lmstudio.js first, and then exported
to the Python SDK via the automated code generation.

See the `lmsjs-schema` exporter folder for additional details.
See the `sdk-schema` exporter folder for additional details.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: lms-with-inferred-unions.json
# timestamp: 2025-02-26T14:00:06+00:00
# timestamp: 2025-02-26T14:13:24+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion src/lmstudio/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
_model_spec_to_api_dict,
)
from ._kv_config import TLoadConfig, TLoadConfigDict, dict_from_fields_key
from ._lmsjs_models import (
from ._sdk_models import (
DownloadProgressUpdate,
EmbeddingRpcEmbedStringParameter,
EmbeddingRpcTokenizeParameter,
Expand Down
2 changes: 1 addition & 1 deletion src/lmstudio/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
sdk_public_api,
)
from .schemas import DictObject, LMStudioStruct, _format_json
from ._lmsjs_models import (
from ._sdk_models import (
ChatHistoryData,
ChatHistoryDataDict,
ChatMessageData as AnyChatMessage,
Expand Down
2 changes: 1 addition & 1 deletion src/lmstudio/json_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
load_config_to_kv_config_stack,
prediction_config_to_kv_config_stack,
)
from ._lmsjs_models import (
from ._sdk_models import (
DownloadProgressUpdate,
EmbeddingChannelLoadModelCreationParameter,
EmbeddingChannelLoadModelCreationParameterDict,
Expand Down
Loading
Loading