refactor: move langfuse wrapper to a module in exchange instead of a package (#138)
Co-authored-by: Alice Hau <ahau@squareup.com>
This commit is contained in:
@@ -150,6 +150,34 @@ goose session resume
|
||||
|
||||
To see more documentation on the CLI commands currently available to Goose check out the documentation [here][cli]. If you’d like to develop your own CLI commands for Goose, check out the [Contributing document][contributing].
|
||||
|
||||
### Tracing with Langfuse
|
||||
> [!NOTE]
|
||||
> This Langfuse integration is experimental and we don't currently have integration tests for it.
|
||||
|
||||
The exchange package provides a [Langfuse](https://langfuse.com/) wrapper module. The wrapper serves to initialize Langfuse appropriately if the Langfuse server is running locally and otherwise to skip applying the Langfuse observe descorators.
|
||||
|
||||
#### Start your local Langfuse server
|
||||
|
||||
Run `just langfuse-server` to start your local Langfuse server. It requires Docker.
|
||||
|
||||
Read more about local Langfuse deployments [here](https://langfuse.com/docs/deployment/local).
|
||||
|
||||
#### Exchange and Goose integration
|
||||
|
||||
Import `from exchange.langfuse_wrapper import observe_wrapper` and use the `observe_wrapper()` decorator on functions you wish to enable tracing for. `observe_wrapper` functions the same way as Langfuse's observe decorator.
|
||||
|
||||
Read more about Langfuse's decorator-based tracing [here](https://langfuse.com/docs/sdk/python/decorators).
|
||||
|
||||
In Goose, initialization requires certain environment variables to be present:
|
||||
|
||||
- `LANGFUSE_PUBLIC_KEY`: Your Langfuse public key
|
||||
- `LANGFUSE_SECRET_KEY`: Your Langfuse secret key
|
||||
- `LANGFUSE_BASE_URL`: The base URL of your Langfuse instance
|
||||
|
||||
By default your local deployment and Goose will use the values in `.env.langfuse.local`.
|
||||
|
||||
|
||||
|
||||
### Next steps
|
||||
|
||||
Learn how to modify your Goose profiles.yaml file to add and remove functionality (toolkits) and providing context to get the most out of Goose in our [Getting Started Guide][getting-started].
|
||||
|
||||
Reference in New Issue
Block a user