8000 feat: support New client with explicit params by emranbm · Pull Request #3 · henomis/langfuse-go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: support New client with explicit params #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

emranbm
Copy link
@emranbm emranbm commented May 13, 2025

Currently, the users of this library need to set the required parameters (like public/private kies) as the env variable in code. With this commit, something like this:

	err := os.Setenv("LANGFUSE_HOST", baseURL)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_HOST: %w", err)
	}
	err = os.Setenv("LANGFUSE_PUBLIC_KEY", publicKey)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_PUBLIC_KEY: %w", err)
	}
	err = os.Setenv("LANGFUSE_SECRET_KEY", secretKey)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_SECRET_KEY: %w", err)
	}
	client := langfuse.New(ctx)

can be done much more simpler; like below:

	client := langfuse.NewWithEndpoint(baseURL, publicKey, secretKey)

The previous behavior is remained unchanged, for backward-compatibilty.

Currently, the users of this library need to set the required parameters
(like public/private kies) as the env variable in code.
With this commit, something like this:
```go
	err := os.Setenv("LANGFUSE_HOST", baseURL)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_HOST: %w", err)
	}
	err = os.Setenv("LANGFUSE_PUBLIC_KEY", publicKey)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_PUBLIC_KEY: %w", err)
	}
	err = os.Setenv("LANGFUSE_SECRET_KEY", secretKey)
	if err != nil {
		return nil, fmt.Errorf("failed to set LANGFUSE_SECRET_KEY: %w", err)
	}
	client := langfuse.New(ctx)
```
can be done much more simpler; like below:
```go
	client := langfuse.NewWithEndpoint(baseURL, publicKey, secretKey)
```

The previous behavior is remained unchanged, for backward-compatibilty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0