Skip to content

Commit e289ddf

Browse files
authored
docs: improve structure (langfuse#325)
1 parent 612a127 commit e289ddf

File tree

82 files changed

+988
-1731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+988
-1731
lines changed

components/Background.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export const Background = () => (
1212
cr={1}
1313
className={cn(
1414
"[mask-image:linear-gradient(to_bottom,white,transparent,transparent)]",
15-
"dark:opacity-70"
15+
"dark:opacity-30"
1616
)}
1717
/>
1818
<LinearGradient
19-
to="rgba(120,119,198,0.25)"
19+
to="rgba(120,119,198,0.15)"
2020
from="rgba(0,0,0,0.0)"
2121
direction="top"
2222
transitionPoint="50%"

components/NotebookBanner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Callout, Cards, Card } from "nextra-theme-docs";
1+
import { Callout } from "nextra-theme-docs";
22
import { Button } from "./ui/button";
33

44
export const NotebookBanner: React.FC<{ src: string; className?: string }> = ({

components/home/Integrations.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const features = [
1414
description:
1515
"Using Langchain? Get full execution traces in 5 minutes by adding the Langfuse Callback Handler to your app. Works for Python and JS projects.",
1616
icon: Link,
17-
href: "/docs/langchain",
17+
href: "/docs/integrations/langchain",
1818
},
1919
{
2020
name: "Web SDK",
@@ -28,7 +28,7 @@ const features = [
2828
description:
2929
"If you use the OpenAI SDK, use the Langfuse drop-in replacement to get full trace data by just changing the import.",
3030
icon: SiOpenai,
31-
href: "/docs/openai",
31+
href: "/docs/integrations/openai",
3232
},
3333
{
3434
name: "API",

components/qaChatbot/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ const welcomeMessage: Message = {
104104
id: "announcement-1",
105105
content: `👋 Do you have any questions about Langfuse? Ask me!
106106
107-
_⚠️ Warning: Do not enter sensitive information. All chat messages can be viewed in the [live demo](/docs/demo). Hosted LLMs by OpenAI are used. Humans (the founders) are available via the chat widget._`,
107+
_⚠️ Warning: Do not enter sensitive information. All chat messages can be viewed in the public demo project. Humans (the founders) are available via the chat widget._`,
108108
} as const;

cookbook/_routes.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
},
66
{
77
"source": "cookbook/integration_langchain.md",
8-
"destination": "/docs/langchain/python.md"
8+
"destination": "/docs/integrations/langchain/python.md"
99
},
1010
{
1111
"source": "cookbook/integration_openai_sdk.md",
12-
"destination": "/docs/openai.md"
12+
"destination": "/docs/integrations/openai.md"
1313
},
1414
{
15-
"source": "cookbook/evaluation_get_started.md",
16-
"destination": "/docs/scores/model-based-evals.md"
15+
"source": "cookbook/evaluation_with_langchain.md",
16+
"destination": "/docs/scores/model-based-evals/langchain.md"
1717
},
1818
{
1919
"source": "cookbook/python_sdk.md",

cookbook/evaluation_get_started.ipynb renamed to cookbook/evaluation_with_langchain.ipynb

+3-11
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,9 @@
66
"id": "SWL354n0DECo"
77
},
88
"source": [
9-
"# Model-based Evaluations in Langfuse\n",
9+
"# Run Langchain Evaluations on data in Langfuse\n",
1010
"\n",
11-
"Model-based evaluations are a powerful tool to automate the evaluation of production completions in Langfuse.\n",
12-
"\n",
13-
"Currently, model-based evals can be applied to production data in Langfuse via the Python SDK. This gives you full flexibility to run various eval libraries on your production data and discover which work well for your use case.\n",
14-
"\n",
15-
"**Coming soon**: support for running model-based evals directly from the Langfuse UI/Server.\n",
16-
"\n",
17-
"## Example using Langchain Evals\n",
18-
"\n",
19-
"This cookbook shows how model-based evaluations can be used to automate the evaluation of production completions in Langfuse. This example uses Langchain but any other eval library can be used as well. Which library is the best to use depends heavily on the use case.\n",
11+
"This cookbook shows how model-based evaluations can be used to automate the evaluation of production completions in Langfuse. This example uses Langchain and is adaptable to other libraries. Which library is the best to use depends heavily on the use case.\n",
2012
"\n",
2113
"This cookbook follows three steps:\n",
2214
"1. Fetch production `generations` stored in Langfuse\n",
@@ -25,7 +17,7 @@
2517
"\n",
2618
"\n",
2719
"----\n",
28-
"Not using Langfuse yet? [Get started](/docs/get-started) by capturing LLM events."
20+
"Not using Langfuse yet? [Get started](https://langfuse.com/docs/get-started) by capturing LLM events."
2921
]
3022
},
3123
{

cookbook/python_sdk.ipynb

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
"id": "qL7HhNyIYNwn"
2929
},
3030
"source": [
31-
"This is a Python SDK used to send LLM data to Langfuse in a convenient way. It uses a worker Thread and an internal queue to manage requests to the Langfuse backend asynchronously. Hence, the SDK adds only minimal latency to your application.\n",
32-
"\n",
33-
"Using Langchain or OpenAI SDK? Use the native [integrations](https://langfuse.com/docs/integrations)."
31+
"This is a Python SDK used to send LLM data to Langfuse in a convenient way. It uses a worker Thread and an internal queue to manage requests to the Langfuse backend asynchronously. Hence, the SDK adds only minimal latency to your application."
3432
]
3533
},
3634
{
@@ -193,8 +191,8 @@
193191
"| input | object | yes | The input of the trace. Can be any JSON object.\n",
194192
"| output | object | yes | The output of the trace. Can be any JSON object.\n",
195193
"| metadata | object | yes | Additional metadata of the trace. Can be any JSON object. Metadata is merged when being updated via the API.\n",
196-
"| user_id | string | yes | The id of the user that triggered the execution. Used to provide [user-level analytics](https://langfuse.com/docs/user-explorer).\n",
197-
"| session_id | string| yes | Used to group multiple traces into a [session](https://langfuse.com/docs/sessions) in Langfuse. Use your own session/thread identifier.\n",
194+
"| user_id | string | yes | The id of the user that triggered the execution. Used to provide [user-level analytics](https://langfuse.com/docs/tracing/users).\n",
195+
"| session_id | string| yes | Used to group multiple traces into a [session](https://langfuse.com/docs/tracing/sessions) in Langfuse. Use your own session/thread identifier.\n",
198196
"| version | string | yes | The version of the trace type. Used to understand how changes to the trace type affect metrics. Useful in debugging.\n",
199197
"| release | string | yes | The release identifier of the current deployment. Used to understand how changes of different deployments affect metrics. Useful in debugging.\n",
200198
"| tags | string[] | yes | Tags are used to categorize or label traces. Traces can be filtered by tags in the UI and GET API. Tags can also be changed in the UI. Tags are merged and never deleted via the API. |"
@@ -519,7 +517,7 @@
519517
"source": [
520518
"## Scores\n",
521519
"\n",
522-
"[Scores](https://langfuse.com/docs/scores) are used to evaluate single executions/traces. They can created manually via the Langfuse UI or via the SDKs.\n",
520+
"[Scores](https://langfuse.com/docs/scores/overview) are used to evaluate single executions/traces. They can created manually via the Langfuse UI or via the SDKs.\n",
523521
"\n",
524522
"If the score relates to a specific step of the trace, specify the `observation_id`.\n",
525523
"\n",

next.config.mjs

+36-21
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,47 @@ const nonPermanentRedirects = [
5959
["/issue", "https://github.com/langfuse/langfuse/issues/new/choose"],
6060
["/security", "/docs/data-security-privacy"],
6161
["/idea", "https://github.com/orgs/langfuse/discussions/new?category=ideas"],
62-
];
6362

64-
const permanentRedirects = [
65-
// Migration 2023-07
66-
["/observability", "/docs/tracing"],
67-
["/docs/debugging-ui", "/docs/tracing"],
68-
// Migration 2023-08-01
69-
// deployment
63+
// Redirect to overview pages
64+
...[
65+
"/docs/integrations",
66+
"/docs/sdk",
67+
"/docs/tracing",
68+
"/docs/scores",
69+
"/docs/scores/model-based-evals",
70+
"/docs/datasets",
71+
].map((path) => [path, path + "/overview"]),
72+
73+
// Redirects to bridge all kinds of old links to new links
74+
["/docs/reference", "https://api.reference.langfuse.com/"],
75+
["/docs/integrations/api", "https://api.reference.langfuse.com/"],
76+
["/docs/langchain", "/docs/integrations/langchain/python"],
77+
["/docs/integrations/langchain", "/docs/integrations/langchain/python"],
78+
["/docs/langchain/python", "/docs/integrations/langchain/python"],
79+
["/docs/langchain/typescript", "/docs/integrations/langchain/typescript"],
80+
["/docs/flowise", "/docs/integrations/flowise"],
81+
["/docs/litellm", "/docs/integrations/litellm"],
82+
["/docs/langflow", "/docs/integrations/langflow"],
83+
["/integrations", "/docs/integrations"],
7084
["/docs/local", "/docs/deployment/local"],
7185
["/docs/self-host", "/docs/deployment/self-host"],
7286
["/docs/cloud", "/docs/deployment/cloud"],
73-
// integrations
74-
["/integrations", "/docs/integrations"],
75-
["/docs/reference", "/docs/api"],
76-
// Integrations back on root
77-
...["langchain", "api", "openai", "sdk", "flowise", "langflow", "litellm"].map(
78-
(integration) => [`/docs/integrations/${integration}/:path*`, `/docs/${integration}/:path*`]),
79-
// sdk integration guide
80-
["/docs/langchain", "/docs/langchain/python"],
81-
["/docs/guides/sdk-integration", "/docs/sdk#example"],
82-
// evals
83-
["/docs/scores/evals", "/docs/scores/model-based-evals"],
84-
// old experimentation to new experimentation
87+
["/docs/guides/sdk-integration", "/docs/sdk/overview"],
88+
["/docs/scores/evals", "/docs/scores/model-based-evals/overview"],
8589
["/experimentation", "/docs/experimentation"],
86-
// token usage to model usage, 2024-01
8790
["/docs/token-usage", "/docs/model-usage-and-cost"],
88-
]
91+
["/docs/debugging-ui", "/docs/tracing/overview"],
92+
["/observability", "/docs/tracing/overview"],
93+
["/docs/openai", "/docs/integrations/openai"],
94+
["/docs/api", "https://api.reference.langfuse.com/"],
95+
["/docs/qa-chatbot", "/docs/demo"],
96+
["/docs/user-explorer", "/docs/tracing/users"],
97+
["/docs/sessions", "/docs/tracing/sessions"],
98+
["/docs/deployment/cloud", "/security"],
99+
["/docs/schedule-demo", "/schedule-demo"],
100+
["/docs/project-sharing", "/docs/rbac"],
101+
];
102+
103+
const permanentRedirects = []
89104

90105
export default withBundleAnalyzer(nextraConfig);

package.json

-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@
3131
"autoprefixer": "^10.4.17",
3232
"class-variance-authority": "^0.7.0",
3333
"clsx": "^2.1.0",
34-
"core-js": "^3.35.1",
3534
"gpt3-tokenizer": "^1.1.5",
3635
"langfuse": "3.0.2",
3736
"lucide-react": "^0.321.0",
38-
"mobx": "^6.12.0",
3937
"next": "^14.1.0",
4038
"next-sitemap": "^4.2.3",
4139
"nextra": "^2.13.3",
@@ -50,10 +48,8 @@
5048
"react-markdown": "^9.0.1",
5149
"react-syntax-highlighter": "^15.5.0",
5250
"react-tweet": "^3.2.0",
53-
"redoc": "^2.1.3",
5451
"remark-gfm": "^4.0.0",
5552
"remark-math": "^6.0.0",
56-
"styled-components": "^6.1.8",
5753
"tailwind-merge": "^2.2.1",
5854
"tailwindcss": "^3.4.1",
5955
"tailwindcss-animate": "^1.0.7",

pages/_meta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"type": "menu",
5656
"items": {
5757
"try-yourself": {
58-
"title": "Try live demo",
58+
"title": "Interactive demo",
5959
"href": "/docs/demo"
6060
},
6161
"video": {

pages/blog/langchain-integration.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ chain = LLMChain(llm=llm, prompt=prompt)
3434
chain.run(input="<user_input", callbacks=[handler])
3535
```
3636

37-
_From the [Langchain integration docs](/docs/langchain)_
37+
_From the [Langchain integration docs](/docs/integrations/langchain/python)_
3838

3939
## Which actions are tracked?
4040

@@ -57,15 +57,15 @@ Demo of the debug view in Langfuse:
5757
![Debug view in Langfuse](/images/blog/langchain/langfuse-debug-ui.gif)
5858
</Frame>
5959

60-
_You can find the code of these examples in the [Langchain integration docs](/docs/langchain)_
60+
_You can find the code of these examples in the [Langchain integration docs](/docs/integrations/langchain/python)_
6161

6262
## About Langfuse
6363

6464
Langfuse is an open source product analytics platform for LLM applications. It is used by teams to track and analyze their LLM app in production with regards to quality, cost and latency across product releases and use cases. In addition, the Langfuse Debug UI helps to visualize the control flow of LLM apps in production. Read our [launch post](/blog/product-analytics-for-LLM-apps) if you want to learn more.
6565

6666
## Next steps
6767

68-
- Read the [Langchain integration](/docs/langchain) docs for more details and examples to get started.
68+
- Read the [Langchain integration](/docs/integrations/langchain/python) docs for more details and examples to get started.
6969
- **Not (exclusively) using Langchain in production?** Follow the [quickstart](/docs/get-started) to get started with the Typescript and Python SDKs that allow you to integrate with your custom LLM app.
7070

7171
## Questions / Feedback?

pages/blog/qa-chatbot-for-langfuse-docs.mdx

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ We've built a new Q&A chatbot to help users find the right information in the La
2222

2323
**Update:** All Langfuse Cloud users now have view-only access to this project. [View live demo](/docs/demo) to explore it yourself.
2424

25-
**Try it** _(also available in the [docs](/docs/qa-chatbot))_
26-
2725
<div className="p-3 rounded-lg mt-2 bg-gradient-to-tr from-green-300 via-blue-500 to-purple-600">
2826
<Chat className="h-96 my-0 bg-background/90" />
2927
</div>

pages/blog/update-2023-07.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ chain = LLMChain(llm=llm, prompt=prompt)
5454
chain.run(input="<user_input", callbacks=[handler])
5555
```
5656

57-
[Integration docs](/docs/langchain)
57+
[Integration docs](/docs/integrations/langchain/python)
5858

5959
## ⚡️ Improved SDKs for Python and JS/TS [#SDKs]
6060

@@ -108,7 +108,7 @@ More user-based analytics and features are coming soon, e.g. APIs to use this da
108108

109109
<Frame>![User reporting](/images/blog/update-july-2023/users.gif)</Frame>
110110

111-
[Learn more](/docs/user-explorer)
111+
[Learn more](/docs/tracing/users)
112112

113113
## 📈 Analytics (alpha) [#analytics]
114114

pages/blog/update-2023-08.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const llm = new OpenAI();
6666
const res = await llm.call("<user-input>", { callbacks: [handler] });
6767
```
6868

69-
[Integration docs](/docs/langchain/typescript)
69+
[Integration docs](/docs/integrations/langchain/typescript)
7070

7171
## ⛓️ Langchain integrations with Trace context [#langchain-trace]
7272

@@ -97,7 +97,7 @@ chain = LLMChain(llm=llm, prompt=PromptTemplate(...))
9797
chain.run("<your-input>", callbacks=[handler])
9898
```
9999

100-
[Docs](/docs/langchain/python)
100+
[Docs](/docs/integrations/langchain/python)
101101

102102
## 📦 Trace context: Releases and versions [#releases-and-versions]
103103

pages/blog/update-2023-09.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ for item in dataset.items:
155155

156156
Datasets are currently in beta on Langfuse Cloud as the API might still slightly change. If you'd like to try it, let us know via the in-app chat.
157157

158-
[Dataset docs](/docs/datasets)
158+
[Dataset docs](/docs/datasets/overview)
159159
[Python Cookbook](/docs/datasets/python-cookbook)
160160

161161
## 📊 In-app dashboards [#analytics]

pages/blog/update-2023-10.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ openai.ChatCompletion.create(
8686

8787
This integration fully supports grouping multiple requests into one trace if they belong to a single invocation. Also you can add scores to evaluate the outputs.
8888

89-
See [integration docs](/docs/openai) for full details.
89+
See [integration docs](/docs/integrations/openai) for full details.
9090

9191
Thanks to [@Dev-Khant](https://github.com/Dev-Khant) for contributing to this.
9292

pages/changelog/2023-08-30-integration-langchain-js.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ import { ChangelogHeader } from "@/components/changelog/ChangelogHeader";
1010

1111
<ChangelogHeader />
1212

13-
Checkout the [documentation](/docs/langchain/typescript) for more details.
13+
Checkout the [documentation](/docs/integrations/langchain/typescript) for more details.

pages/changelog/2023-09-25-datasets.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@ Datasets are currently in beta on Langfuse Cloud as the API might still slightly
8686

8787
Links:
8888

89-
- [Dataset docs](/docs/datasets)
89+
- [Dataset docs](/docs/datasets/overview)
9090
- [Python Cookbook](/docs/datasets/python-cookbook)

pages/changelog/2023-10-25-openai-sdk-integration.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import { ChangelogHeader } from "@/components/changelog/ChangelogHeader";
1010

1111
<ChangelogHeader />
1212

13-
For detailed instructions checkout the [docs/cookbook](/docs/openai).
13+
For detailed instructions checkout the [docs/cookbook](/docs/integrations/openai).
1414

1515
Thanks to [@Dev-Khant](https://github.com/dev-khant) for the initial contribution!

pages/changelog/2023-11-13-support-for-langchain-expression-language.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ To use Langfuse, simply add the callback handler to the invoke method:
1616
chain.invoke(input, config={"callbacks":[handler]})
1717
```
1818

19-
See [Langchain integration docs](/docs/langchain/python) for full details.
19+
See [Langchain integration docs](/docs/integrations/langchain/python) for full details.

pages/changelog/2023-11-16-openai-sdk-version-1.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ openai.langfuse_public_key = "YOUR_PUBLIC_KEY"
2424
openai.langfuse_secret_key = "YOUR_SECRET_KEY"
2525
```
2626

27-
See the [OpenAI SDK integration](/docs/openai) page for more information.
27+
See the [OpenAI SDK integration](/docs/integrations/openai) page for more information.

pages/changelog/2023-12-13-sessions.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ Example use cases:
1515
- Conversations / threads
1616
- Multiple interactions within a user session
1717

18-
To get started, add a `sessionId` string when creating/updating a trace. See [docs](/docs/sessions) for full details on how to add sessions to your traces.
18+
To get started, add a `sessionId` string when creating/updating a trace. See [docs](/docs/tracing/sessions) for full details on how to add sessions to your traces.

pages/changelog/2023-12-28-v2-sdks.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ langfuse.generation(
6767

6868
For every chain run, a new trace is created. Previously all runs that were traced with the same Callback Handler instance were grouped into the same trace. While this was intended to be able to trace complex applications, it is not a great default for most users.
6969

70-
For those who want this behavior, you can create a trace and get a Langchain Handler that is scoped to the trace ([Python](/docs/langchain/python#upgrading-from-v1xx-to-v2xx), [JS/TS](/docs/langchain/typescript#upgrade1to2)).
70+
For those who want this behavior, you can create a trace and get a Langchain Handler that is scoped to the trace ([Python](/docs/integrations/langchain/python#upgrading-from-v1xx-to-v2xx), [JS/TS](/docs/integrations/langchain/typescript#upgrade1to2)).
7171

7272
### Other
7373

pages/changelog/2024-01-03-prompt-management.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ langfuse.get_prompt("clemens-awesome-prompt")
2323

2424
### 🕹️ Give it a spin
2525

26-
Head over to [our docs](/docs/prompts) to learn more and get started. Alternatively, see a demo by [logging in](https://cloud.langfuse.com) and selecting the ‘langfuse-docs’ project since we use Langfuse Prompt Management for the [QA-chatbot](/docs/qa-chatbot).
26+
Head over to [our docs](/docs/prompts) to learn more and get started. Alternatively, see a [live demo](/docs/demo) since we use Langfuse Prompt Management to build a demo project that is integrated with Langfuse.
2727

2828
If you have any feedback, do get in touch on [Discord](/discord).

0 commit comments

Comments
 (0)