Repository navigation
Conversation
The SDK's copy of the platform's api contracts was at smarter v0.25.1. Smarter v0.27.1 (e220f3076ce65a3bf4d3f34df2eb49042e18eab9) replaced an LLMClient's built-in functions with installable extensions (platform commit fda234a37), and renamed them everywhere: the REST routes, the REST and chat config responses, and the LLMClient manifest. Against a v0.27.1 platform, llm_clients.functions() requested /llm-clients/{id}/functions, which no longer exists. The SDK's models also had no fields for the renamed data: the chat config's extensions were kept only as untyped extra fields, and an LLMClient's extensions were dropped. This syncs the contracts to v0.27.1 with make sam-models SMARTER_REF=v0.27.1, and follows the rename in the SDK. Python is the reference SDK: smarter-nodejs and smarter-golang make the same change.
This changes the SDK's public api: llm_clients.functions() and the models named after functions are renamed, with no deprecated aliases. An alias would only call a route that the platform no longer serves. Code that used them must use the new names below.
LLMClients (smarter/resources/llmclients.py, smarter/models/llmclient.py, smarter/models/__init__.py):
- LLMClients.functions(id) is now LLMClients.extensions(id), and requests /llm-clients/{id}/extensions.
- LLMClientFunction is now LLMClientExtension, exported from smarter.models, with a new extension field (Optional[int]), the Extension's id. name is the extension's slug, e.g. weather.
- LLMClient.functions is now LLMClient.extensions.
- The docstrings and field descriptions of LLMClientTool and LLMClient say extension instead of function: a tool's kind is now Extension, not Function.
Chat api (smarter/models/chat.py):
- PromptChatApiLLMClientFunction is now PromptChatApiLLMClientExtension, with the platform's fields: extension (int), name (str, required), version (Optional[str], the installed version) and enabled (bool).
- PromptChatApiFunctionList is now PromptChatApiExtensionList, whose list is extensions.
- PromptChatApiListMetaData's total_functions and functions_returned are now total_extensions and extensions_returned.
- PromptChatApiConfig.functions is now PromptChatApiConfig.extensions. __all__ follows the renames.
Generated SAM models (smarter/models/sam/), regenerated from the new schemas:
- SAMLLMClientSpec.functions is now extensions, a list of extension slugs.
- An LLMClient's defaultSystemRole may be 32768 characters, up from 2048 (platform commit 4b08fc5a5). A Plugin's prompt.systemRole now has the same maximum, which the six plugin kinds' models enforce with constr(max_length=32768), as the platform does.
- The descriptions of the styles' buttons and the conversationHeader color say that the header's buttons take the header's text color (platform commit 1aa73c2a0).
Contracts and fixtures (tests/data/):
- tests/data/contracts/ and tests/data/sam/ are the platform's files at v0.27.1, copied with git show at the tag.
- The recorded responses follow the rename, adding keys and keeping the platform's key order: llmclient.json, llmclients.json and config.json say extensions where they said functions, and a tool's kind Extension. Each extension row gains extension, and the chat config's rows also gain version and enabled, with the meta_data counts renamed. describe_llmclient.json's spec says extensions. llmclient_functions.json is renamed to llmclient_extensions.json, with the extension id added.
- The dev server was not running, so the new values were derived from the platform's contract models rather than recorded: the calculator extension's id is 1, and its version is 1.0.0, the contract's own example. The fixtures are the same in smarter-nodejs and smarter-golang.
Legacy data (smarter/resources/data/chatbot.json): its manifest's spec.functions is now spec.extensions, so that no copy of a manifest in the repository uses the old key. Nothing reads this file, and setup.py doesn't package it.
Tests:
- tests/test_contracts.py calls llm_clients.extensions(), its NOT_CALLED names llmclient_extension_retrieve instead of llmclient_function_retrieve, and TestRecordedResponses validates llmclient_extensions against the extensions route.
- tests/test_llmclients.py reads the extensions route and checks the extension's id, checks the chat config's extensions (the total, the slug and enabled), and expects the tool's kind Extension.
- tests/live/test_live.py calls llm_clients.extensions().
Status: make test passes with 132 tests (10 skipped: the live tests), make coverage reports 100 percent, and the pre-commit hooks pass on the changed files. The live tests were not run, because no platform was running. The same sync is made in smarter-cli, smarter-nodejs, smarter-golang and smarter-vscode-yaml, one commit each. The chat config's total_tools field, added after v0.27.1 in platform commit a8a2a48cb, is not released yet, and comes with the next sync.
Co-authored-by: Lawrence McDaniel <lpm0073@gmail.com>
merge main
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
|
🎉 This PR is included in version 0.5.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request Template
Type of Change
Resolves
Changes
Describe what this Pull Request does
Testing
Describe the testing that has been done or needs to be done
Screenshots
Add any relevant screenshots
Dependencies
List dependencies
Breaking Changes
Describe any breaking changes