-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example and cross references across docs
- Loading branch information
1 parent
fbeac30
commit 0609a9a
Showing
4 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters