Skip to content

feat: support New client with explicit params - #3

Open
emranbm wants to merge 1 commit into
henomis:mainfrom
emranbm:new-with-endpoint
Open

feat: support New client with explicit params#3
emranbm wants to merge 1 commit into
henomis:mainfrom
emranbm:new-with-endpoint

Conversation

@emranbm

@emranbm emranbm commented May 13, 2025

Copy link
Copy Markdown

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