Skip to content

Releases: rusih100/langfuse-hotswap

v1.1.1

Choose a tag to compare

@rusih100 rusih100 released this 02 Nov 03:00
c80b3d0

Fixed

  • LangfusePromptTemplate now removes human messages with empty content after rendering, including messages supplied through placeholders, before passing them to the model.

v1.1.0

Choose a tag to compare

@rusih100 rusih100 released this 22 Oct 06:17
9a62563

Highlights

  • langfuse 4.x support. The dependency is now langfuse>=4,<6. Python SDK v4 is still
    supported by Langfuse and is the SDK to use with self-hosted Langfuse v3: SDK v5 needs Langfuse
    v4.59.0 or later. Nothing changes in the API or the behavior; the same code works on both.
  • Both majors tested. CI runs the tests, the SDK contract tests among them, on the lowest
    supported langfuse 4.0.0, and the nightly workflow on the latest 4.x and 5.x releases.

Upgrading

pip install -U langfuse-hotswap

No code changes are needed. To stay on SDK v4, pin langfuse>=4,<5 in your project.

v1.0.1

Choose a tag to compare

@rusih100 rusih100 released this 21 Oct 09:11
16f740c

Highlights

  • Stable API. The first stable release: the public API follows Semantic Versioning from here
    on, and nothing in it breaks before 2.0.

  • Factory hooks. hooks on LangfuseChainFactory wraps the model of every chain the factory
    creates, so a policy such as retries is set once per process. The chain's own hooks run first,
    so with_structured_output and bind_tools still get the chat model:

    factory = LangfuseChainFactory(
        client,
        models,
        hooks=[lambda model: model.with_retry(stop_after_attempt=3)],
    )
    chain = factory.create("support-reply").with_structured_output(Reply)

    A hook with a prompt parameter receives the prompt client, as a chain hook does.

  • Python 3.14. Tested in CI on Python 3.11–3.14.

  • Lighter install. The package no longer depends on langchain; langchain-core is enough.

  • Lowest versions tested. CI runs the tests on the lowest declared langchain-core,
    langfuse, typing-extensions and jinja2, not only the latest.

Breaking changes

  • PromptManager is no longer part of the public API. It was an internal building block of the
    runnable; LangfuseChainFactory, LangfusePromptRunnable, LangfusePromptTemplate and the
    errors are unchanged.

Migrating from 0.2

v0.2.0

Choose a tag to compare

@rusih100 rusih100 released this 20 Oct 14:18

Highlights

  • Models live in your code. Pass ChatOpenAI(...), ChatAnthropic(...) or any LangChain
    chat model to the factory by name; the prompt config picks one with provider. Credentials,
    endpoints and HTTP clients never come from Langfuse.
  • Allow only what you list. allowed_config_keys is None by default: the config selects
    the model and changes nothing else. Name the fields editors may tune, or pass "any".
  • Template formats. langfuse (the playground rules) by default; f-string, mustache
    and jinja2 per factory or per prompt.
  • Simpler core. PromptManager owns fetch, compare and rebuild; the runnable is 200 lines.
    A cold start fetches once, a broken version is retried when the prompt changes, an outage is
    logged once.

Breaking changes

  • LangfuseChainFactory(client, models=..., allowed_config_keys=None, label=None, template_format="langfuse")
  • create(prompt_name, *, label=None, version=None, **get_prompt_kwargs); fallback is rejected.
  • Config key model_provider is now provider.
  • Removed: model_kwargs, providers, DEFAULT_ALLOWED_CONFIG_KEYS, is_blocked_config_key,
    the batch overrides.

Migrating from 0.1

factory = LangfuseChainFactory(
    get_client(),
    models={"openai": ChatOpenAI(api_key=key, timeout=30)},
    allowed_config_keys={"model", "temperature", "max_tokens"},
)

Rename model_provider to provider in the prompt configs. Replace create(fallback=...) with
.with_fallbacks([local_chain], exceptions_to_handle=(PromptFetchError,)).

Full list: CHANGELOG.
Docs: https://rusih100.github.io/langfuse-hotswap/

v0.1.1

Choose a tag to compare

@rusih100 rusih100 released this 19 Oct 13:47

Added

  • Contract tests pin the Langfuse SDK behavior the library relies on: the prompt client fields,
    the cache serving a fresh entry as the same object and a stale one without blocking, and the
    rendering rules. CI runs the suite on the lowest supported langfuse and a nightly workflow on
    the latest 5.x release.
  • Documentation site in English and Russian, published to GitHub Pages; the README is now a short
    pitch with an animated demo and links there. README.ru.md
  • examples/: one short script per feature.
  • CHANGELOG.md.

Changed

  • Prompts are compared by name, version, content and config iad of the
    SDK __eq__; the template renderer is a copy of the SDK one, checked against it by a contract
    test. Nothing from the private SDK modules is imported at r
  • The sdist contains the package, the tests and the changelog only.

Documentation: https://rusih100.github.io/langfuse-hotswap

v0.1.0

Choose a tag to compare

@rusih100 rusih100 released this 19 Oct 12:14

First release.

  • LangfuseChainFactory and LangfusePromptRunnable: a LangChain Runnable whose model and parameters come from the Langfuse prompt config and are rebuilt when the prompt changes.
  • Config allowlist (DEFAULT_ALLOWED_CONFIG_KEYS) and blocked infrastructure keys (is_blocked_config_key); the provider must be named explicitly.
  • The last working chain keeps serving when a new prompt version fails to build or Langfuse is unreachable.
  • Prompts are rendered with the Langfuse TemplateParser, placeholders included.
  • with_model, with_structured_output and bind_tools hooks.

Requires Python 3.11+, langchain>=1,<2, langfuse>=5,<6.

Full Changelog: https://github.com/rusih100/langfuse-hotswap/commits/v0.1.0