Repository navigation
feat: codemode-decision package, decision.ask across OpenAI and TypeSafe (SHFT-2968) - #105
Merged
Merged
Conversation
…tested and documented (SHFT-2968)
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.
Adds
@shiftlabs/codemode-decision: one plugin,decision, that asks a decision model questions through the provider the connection chooses.Action
decision.ask({ input?, images?, questions })→{ provider, model, inputTokens?, answers }, with answers keyed by question name.yesNo,choice(2 to 255 options),score(2 to 10 levels); up to 400 questions a call.yesNogivesprobability;choiceandscoregive the answer,confidenceand every option's or level's probability. A declined question is{ type: "refusal" }.inputis text or a JSON object.imagesare local PNG or JPEG paths, identified by their bytes.Design
provider, else the first with a key: openai, then typesafe) and themodel. The action has no input for either, and there is nomodelsaction.boxand long context, OpenAI conversation and tool-call input, images inside one question.typesafeplugin stays.decision([mine, ...PROVIDERS]).Also in this PR, in codemode core
credentials/router.ts:routerCredential,routerConnectionFields,namedProvider,keyedProviders. websearch, imagegen and decision use them in place of three copies. Documented as a recipe indocs/credentials.md.utils/image.ts:imageFacts,readLocalImage,imageDataUrl,imageBase64,IMAGE_EXTENSIONS, moved from imagegen so decision can use them.actions.describeshows the shape of a keyed object's values (values), soquestionsis discoverable.websearch and imagegen change only by that refactor.
Not proven
No question has been asked with a working key. Request and answer shapes come from OpenAI's Decisions guide and reference and TypeSafe's System One reference, with stubbed hosts in tests. Both endpoints answer 401 to a made-up key.
confidenceis each provider's own figure and is not comparable across providers.label: descriptiontext.Tests
19 in the package; 2,748 in codemode; all repository gates pass.