Configuration Reference

On this page

Every configurable option in the library, in one place. All of these are plain Python constructor/keyword arguments — there is no config-file loader, environment-variable reader, or CLI flag parser anywhere in the source.

PromptEngine(...)

OptionTypeDefaultPurpose
context_managerContextManagernew instanceOverride context-engineering behavior
guardrail_engineGuardrailEnginenew instanceOverride guardrail selection/rendering
extra_guardrailsList[Guardrail]NoneAdd custom always-considered guardrails
enable_cacheboolTrueToggle the SHA-256 prompt cache
cache_ttl_secint300Cache entry lifetime
max_cache_sizeint256Max cache entries before oldest-eviction
enable_auto_detectboolTrueToggle keyword-based type/strategy/complexity inference
memory_store, cache_store, routerAnyNoneStored but unused by any method in the provided source — see architecture

See api/prompt_engine.

PromptEngine.build(...) / PromptRequest

OptionTypeDefaultRuntime effect
prompt_typePromptType | strQASelects the default strategy (via PromptBuilder) and gates STAY_ON_TOPIC guardrail
strategyPromptStrategy | strSIMPLESelects the concrete BaseStrategy used
output_formatOutputFormat | strTEXTSelects the format instruction appended by GuardrailEngine
complexityQueryComplexity | strSIMPLEMay trigger a strategy upgrade (SIMPLE type default → COT/MULTI_HOP) and adds SELF_CHECK guardrail at COMPLEX/EXPERT
user_profileUserProfile | strGENERALSelects the persona line appended to the system prompt
max_context_tokensint3000Token budget passed to ContextManager.build
max_answer_tokensint512Stored on PromptRequest; not read by any code path in the provided source — appears to be a hint intended for the calling application (e.g. to set the LLM API's own max_tokens), not enforced internally
output_schemaOptional[Dict]NoneAppended as a JSON schema block when output_format == STRUCTURED
languagestr"en"Resolves to Lang.EN/Lang.AR templates via resolve_lang
enable_guardrailsboolTrueGates most (not all) guardrails — see api/guardrails.md
enable_citationsboolTrueGates the CITE_SOURCES guardrail (also requires non-empty documents)
enable_uncertaintyboolTrueGates the UNCERTAINTY guardrail
session_id, user_id, trace_idstr""Passed through to BuiltPrompt and the trace log; not validated
extraDict{}Only key read anywhere: extra["tools"], by ReActStrategy

[!WARNING] max_answer_tokens is not enforced Despite being documented in PromptEngine.build's own docstring as "a hint to the LLM about expected answer length", no code path in the provided source reads request.max_answer_tokens after it's stored. It is not injected into any prompt text and not used to truncate anything. If you need the model to respect an answer-length limit, you must communicate it yourself (e.g. via the LLM API's own max_tokens parameter, or by adding a custom guardrail).

ContextManager(...)

OptionTypeDefaultRuntime effect
dedup_thresholdfloat0.85Jaccard similarity cutoff for near-duplicate removal
min_doc_tokensint5Minimum approximate tokens for a doc to be considered
use_lost_in_middleboolTrueEnables relevance-aware reordering (docs > 3)
summarize_overflowboolFalseNo effect — declared but never read (see api/context_manager)
max_memory_messagesint10Default conversation turns (not messages) kept by format_memory

GuardrailEngine(...)

OptionTypeDefaultRuntime effect
extra_guardrailsList[Guardrail]NoneAlways appended after rule-based selection, regardless of enable_guardrails

PromptOptimizer(...)

OptionTypeDefaultRuntime effect
max_total_tokensint6000Hard cap; only user is ever truncated to meet it
enable_fillerboolTrueStrip common LLM padding phrases
enable_dedupboolTrueRemove user paragraphs duplicated verbatim in system
enable_whitespaceboolTrueNormalize spaces/blank lines

ABTestRunner(...)

OptionTypeDefaultRuntime effect
llmAnyrequiredMust expose .generate(str) -> str
variantsList[PromptVariant]required, ≥ 2Raises ValueError if fewer than 2
rag_systemAnyNoneOptional automatic context retrieval
judge_llmAnyNone (→ llm)Separate model for scoring
batch_delay_secfloat0.0Sleep between queries in run()

Enum-valued options at a glance

See api/types for the full member tables of PromptType, PromptStrategy, OutputFormat, QueryComplexity, and UserProfile.

Best practices

  • Set enable_cache=False in any environment where prompt inputs vary in ways not captured by the cache key (see api/prompt_engine.md#cache) — e.g. if document metadata or scores matter to your use case but aren't part of the hash.
  • Don't rely on max_answer_tokens to constrain model output length; it is currently inert.
  • If you need summarize_overflow-style behavior (summarizing docs that don't fit the budget instead of truncating them), you'll need to implement it yourself — the flag exists but does nothing in this version.

Related pages