feat: implement generic LLM-based template logic executor#126
Open
ad23b1012 wants to merge 1 commit intoaccordproject:mainfrom
Open
feat: implement generic LLM-based template logic executor#126ad23b1012 wants to merge 1 commit intoaccordproject:mainfrom
ad23b1012 wants to merge 1 commit intoaccordproject:mainfrom
Conversation
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.
Description
This PR introduces a generic Large Language Model (LLM) executor core into
template-engine. It allows templates to execute logic strictly based on their natural language text and Concerto data models without requiring an explicit TypeScriptlogic.tsfile.By passing
runtime: "llm", the engine falls back to the newLLMLogicExecutorwhich bridges reasoning APIs with strictly validated Concerto schemas.Key Features
src/llm): Exposes theLLMLogicExecutor, responsible for evaluating request structures using natural language and model context instead of a JS compiler.fetch()classes for interacting with OpenAI endpoints (including Ollama, vLLM) and Anthropic Claude APIs without causing SDK dependency bloat.LLMConfigconfigurations straight from the archive'spackage.json(accordproject.llm), Node environment variables, or run-time parameter overwrites.ResponseParser): Guarantees identical type-safety to legacy TypeScript pipelines by explicitly stripping Markdown formatting out of API responses and piping all outputs retroactively through the engine's legacySerializer.fromJSONvalidation schema endpoints.Architectural Impact
Modifications directly to the
TemplateArchiveProcessor.tsinitandtriggerpipelines were kept intentionally minimal to prevent breaking existing infrastructure. Legacy logic execution continues normally if the evaluated compilation language remainstypescript.Testing
LLMLogicExecutor.test.ts(24 new test suites covering retry injection sweeps, prompt generations, model context attachments).TemplateArchiveProcessorTS evaluations continued functioning completely unaffected structurally.archives/latedeliveryandpenalty-llmensuring full serialization.Note for reviewers: To properly parse an
llmfolder archive natively via.fromDirectory(), a small upstream whitelist adjustment PR strictly permittingllmruntimes onMetadata.tsviacicero-coreis expected as a follow-up.