Skip to content

Commit

Permalink
add example and cross references across docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcklingen committed Dec 3, 2024
1 parent fbeac30 commit 0609a9a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 32 deletions.
28 changes: 28 additions & 0 deletions components-mdx/get-started-js-sdk.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
```ts filename="server.ts"
import { Langfuse } from "langfuse";

const langfuse = new Langfuse();

const trace = langfuse.trace({
name: "my-AI-application-endpoint",
});

// Example generation creation
const generation = trace.generation({
name: "chat-completion",
model: "gpt-3.5-turbo",
modelParameters: {
temperature: 0.9,
maxTokens: 2000,
},
input: messages,
});

// Application code
const chatCompletion = await llm.respond(prompt);

// End generation - sets endTime
generation.end({
output: chatCompletion,
});
```
32 changes: 3 additions & 29 deletions pages/docs/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ If you are looking for other features, see the [overview](/docs).

import GetStartedLangchainPythonArgs from "@/components-mdx/get-started-langchain-python-constructor-args.mdx";
import GetStartedLangchainJsArgs from "@/components-mdx/get-started-langchain-js-constructor-args.mdx";
import GetStartedJsSdk from "@/components-mdx/get-started-js-sdk.mdx";
import GetStartedLlamaindexPythonArgs from "@/components-mdx/get-started-llamaindex-python-constructor-args.mdx";
import EnvPython from "@/components-mdx/env-python.mdx";
import EnvJs from "@/components-mdx/env-js.mdx";
Expand Down Expand Up @@ -73,36 +74,9 @@ import { Langfuse } from "https://esm.sh/langfuse"
<EnvJs />
Example usage, most of the parameters are optional and depend on the use case. For more information, see the [typescript SDK docs](/docs/sdk/typescript/guide).
Example usage, most of the parameters are optional and depend on the use case. For more information, see the [JS/TS SDK docs](/docs/sdk/typescript/guide) or [end-to-end example notebook](/docs/sdk/typescript/example-notebook).
```ts filename="server.ts"
import { Langfuse } from "langfuse";

const langfuse = new Langfuse();

const trace = langfuse.trace({
name: "my-AI-application-endpoint",
});

// Example generation creation
const generation = trace.generation({
name: "chat-completion",
model: "gpt-3.5-turbo",
modelParameters: {
temperature: 0.9,
maxTokens: 2000,
},
input: messages,
});

// Application code
const chatCompletion = await llm.respond(prompt);

// End generation - sets endTime
generation.end({
output: chatCompletion,
});
```
<GetStartedJsSdk />
</Tab>
<Tab>
Expand Down
2 changes: 1 addition & 1 deletion pages/docs/sdk/python/decorators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Want more control over the traces logged to Langfuse? Check out the [low-level P

## Example

_Simple example (decorator + openai integration)_
Simple example (decorator + OpenAI integration) from the [end-to-end example notebook](/docs/sdk/python/example):

import GetStarted from "@/components-mdx/get-started-python-decorator-openai.mdx";

Expand Down
13 changes: 11 additions & 2 deletions pages/docs/sdk/typescript/guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,25 @@ import { Callout } from "nextra/components";
</a>
</div>

If you are working with Node.js, Deno, or Edge functions, the `langfuse` library is the simplest way to integrate Langfuse into your application. The library queues calls to make them non-blocking.
If you are working with Node.js, Deno, or Edge functions, the `langfuse` library is the simplest way to integrate [Langfuse Tracing](/docs/tracing) into your application. The library queues calls to make them non-blocking.

Supported runtimes:

- [x] Node.js
- [x] Edge: Vercel, Cloudflare, ...
- [x] Deno

Want to capture data (e.g. user feedback) from the browser? Use [LangfuseWeb](/docs/sdk/typescript/guide-web)
Want to capture data (e.g. user feedback) from the browser? Use [`LangfuseWeb`](/docs/sdk/typescript/guide-web).

Before getting started, please read the conceptual introduction to [tracing](/docs/tracing).

## Example

Simple example from the [end-to-end example notebook](/docs/sdk/typescript/example-notebook):

import GetStartedJsSdk from "@/components-mdx/get-started-js-sdk.mdx";

<GetStartedJsSdk />
## Installation

```sh
Expand Down

0 comments on commit 0609a9a

Please sign in to comment.