Skip to content

Commit 8ff6a56

Browse files
committed
chore: add usage example
1 parent 781a0d0 commit 8ff6a56

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,31 @@ as well.
2929

3030
## Usage
3131

32+
Instantiate the Langfuse Client with the respective endpoint and your API Keys.
3233

34+
```java
35+
import com.langfuse.client.LangfuseClient;
36+
37+
LangfuseClient client = LangfuseClient.builder()
38+
.url("https://cloud.langfuse.com") // 🇪🇺 EU data region
39+
// .url("https://us.cloud.langfuse.com") // 🇺🇸 US data region
40+
// .url("http://localhost:3000") // 🏠 Local deployment
41+
.credentials("pk-lf-...", "sk-lf-...")
42+
.build();
43+
```
44+
45+
Make requests using the clients:
46+
47+
```java
48+
import com.langfuse.client.core.LangfuseClientApiException;
49+
50+
try {
51+
PromptMetaListResponse prompts = client.prompts().list();
52+
} catch (LangfuseClientApiException error) {
53+
System.out.println(error.getBody());
54+
System.out.println(error.getStatusCode());
55+
}
56+
```
3357

3458
## Updating
3559

0 commit comments

Comments
 (0)