You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: upgrade docstrings as a first-class documentation surface for AI agents (#1760)
* docs: upgrade docstrings as a first-class documentation surface for AI agents
Coding agents treat the installed package as primary documentation
(help(), inspect, grepping site-packages), so this improves the
docstrings they hit most, verified against code and tests:
- propagate_attributes: fix broken examples that called it as a client
method (it is a top-level import) and used the nonexistent
start_generation; document wrap-the-root-span ordering; add See also
- Langfuse.api/async_api: new docstrings covering list-vs-get semantics
(list endpoints return observation/score IDs as strings), asynchronous
ingestion with a bounded retry snippet, and scores read methods
(get_many/get_by_id; there is no scores.get)
- flush(): note that server-side ingestion lags flush by a few seconds
- @observe: document capture_input/capture_output/transform_to_string,
as_type="generation" with update_current_generation example
- run_experiment/Evaluation: add RAG LLM-as-a-judge example
(faithfulness, answer relevance) and CI regression testing via
langfuse/experiment-action; docstring for RunnerContext.run_experiment
- package docstring/README/pyproject: lead with full capability map,
current env var names, llms.txt pointer; fix stale v3 docs link and
broken langfuse.otel import in the Langfuse class example
- deprecation hygiene: emit DeprecationWarning when host= or
LANGFUSE_HOST is the effective base URL source (behavior change);
deprecation messages now name the exact replacement import
Generated code under langfuse/api/ is untouched; list-vs-get and
ingestion notes for it live on the non-generated api property and
should also be mirrored into the fern spec in langfuse/langfuse.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: remove runtime DeprecationWarning for host/LANGFUSE_HOST
Keep the change docs-only; the deprecation remains documented in the
host parameter docstring and the LANGFUSE_HOST env var description.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: align docstrings with langfuse.com docs wording and links
Cross-checked against the langfuse-docs repo:
- api/async_api/flush: align ingestion-lag wording with query-via-sdk
docs (typically 15-30s, not "a few seconds"), replace retry snippet
with the documented deadline-based pattern (capped backoff), note that
a successful trace.get does not imply observations/scores are complete,
recommend observations.get_many(trace_id=...) for row-level reads and
the Metrics API for aggregation; add anchored doc links
- run_experiment RAG example: use item.input (DatasetItem attribute)
instead of item["input"], matching the documented dataset task shape
- RegressionError: correct action input name to should_fail_on_regression
(was should_fail_on_error; verified against experiment-action action.yml)
- add See-also links: observation-types (observe/as_type) and
environments (propagate_attributes)
All 10 docstring URLs verified to map to content pages in langfuse-docs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: highlight v2 data APIs as recommended, correct score read guidance
- api property: call out api.observations and api.metrics as the
recommended high-performance v2 endpoints (SDK v4 defaults) and note
their v1 equivalents under api.legacy.* are less performant, not
recommended for new workflows, and will be deprecated
- scores: point reads at api.scores_v3.get_many_v3; the v2
api.scores.get_many/get_by_id are deprecated per the API spec and no
longer available on Langfuse v4+ servers
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: address PR review — runnable propagation example, observations-first examples
- propagate_attributes example: start_observation() returns a plain
observation (no __enter__), so both `with` usages crashed at runtime;
switch to start_as_current_observation (smoke-ran the example)
- api/async_api/flush docstrings: use the v2 observations endpoint
(api.observations.get_many with fields selection) as the primary
example per review, matching the query-via-sdk docs page examples
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: clarify v2 score reads are removed in future Langfuse v4 servers
Current servers are v3.x; the spec's removal note is forward-looking.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* edits
* docs: revert deprecation message changes to keep PR strictly docs-only
Restore the original @deprecated decorator strings on set_trace_io and
set_current_trace_io so no runtime-visible string changes remain; the
corrected propagate_attributes import guidance stays in the docstrings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* push
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The [Langfuse](https://langfuse.com) Python SDK covers the full platform: **observability/tracing** (OpenTelemetry-based, with OpenAI and LangChain integrations), **datasets & experiments** (offline evaluation and regression testing of prompt/model changes, including [CI via GitHub Actions](https://github.com/langfuse/experiment-action)), **LLM-as-a-judge and custom evaluations/scores**, **prompt management**, and a **full REST API client**.
0 commit comments