Skip to content
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

Updating langfuse integration #345

Merged
merged 22 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ignore_missing_imports = True
# We don't want to ignore all missing imports as we want to catch those in our own code
# But for certain libraries they don't have a stub file, so we only enforce import checking for our own libraries.
# Another alternative would be to list out every single dependency that does not have a stub.
[mypy-prediction_market_agent.*]
[mypy-prediction_market_agent_tooling.*]
ignore_missing_imports = False
[mypy-scripts.*]
ignore_missing_imports = False
Expand Down
112 changes: 102 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions prediction_market_agent_tooling/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class APIKeys(BaseSettings):
GOOGLE_SEARCH_ENGINE_ID: t.Optional[SecretStr] = None

LANGFUSE_SECRET_KEY: t.Optional[SecretStr] = None
LANGFUSE_PUBLIC_KEY: t.Optional[SecretStr] = None
LANGFUSE_PUBLIC_KEY: t.Optional[str] = None
LANGFUSE_HOST: t.Optional[str] = None
LANGFUSE_DEPLOYMENT_VERSION: t.Optional[str] = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new env variable that is populated by git commit sha in PMA's docker building pipeline; it will show us, in the UI, what version of PMA was used.


TAVILY_API_KEY: t.Optional[SecretStr] = None

Expand Down Expand Up @@ -127,7 +128,7 @@ def langfuse_secret_key(self) -> SecretStr:
)

@property
def langfuse_public_key(self) -> SecretStr:
def langfuse_public_key(self) -> str:
return check_not_none(
self.LANGFUSE_PUBLIC_KEY, "LANGFUSE_PUBLIC_KEY missing in the environment."
)
Expand All @@ -138,6 +139,14 @@ def langfuse_host(self) -> str:
self.LANGFUSE_HOST, "LANGFUSE_HOST missing in the environment."
)

@property
def default_enable_langfuse(self) -> bool:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used as the default argument in DeployableAgent init method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and self.LANGFUSE_DEPLOYMENT_VERSION is not None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not necessary for langfuse to work, it can be None

return (
self.LANGFUSE_SECRET_KEY is not None
and self.LANGFUSE_PUBLIC_KEY is not None
and self.LANGFUSE_HOST is not None
)

@property
def tavily_api_key(self) -> SecretStr:
return check_not_none(
Expand Down
Loading
Loading