-
Notifications
You must be signed in to change notification settings - Fork 8
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
469 missing information in ipfsagentresult #521
Changes from 9 commits
10af4a8
1ed4389
dda8993
bcd2682
f353ff3
75228f6
ef5e579
9794077
d81bce3
fac7538
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -153,10 +153,10 @@ def langfuse_update_current_trace( | |||||||||||||||||||||||||||||||||||||||
input=input, | ||||||||||||||||||||||||||||||||||||||||
output=output, | ||||||||||||||||||||||||||||||||||||||||
user_id=user_id or getpass.getuser(), | ||||||||||||||||||||||||||||||||||||||||
session_id=session_id | ||||||||||||||||||||||||||||||||||||||||
or self.session_id, # All traces within a single run execution will be grouped under a single session. | ||||||||||||||||||||||||||||||||||||||||
version=version | ||||||||||||||||||||||||||||||||||||||||
or APIKeys().LANGFUSE_DEPLOYMENT_VERSION, # Optionally, mark the current deployment with version (e.g. add git commit hash during docker building). | ||||||||||||||||||||||||||||||||||||||||
session_id=session_id or self.session_id, | ||||||||||||||||||||||||||||||||||||||||
# All traces within a single run execution will be grouped under a single session. | ||||||||||||||||||||||||||||||||||||||||
version=version or APIKeys().LANGFUSE_DEPLOYMENT_VERSION, | ||||||||||||||||||||||||||||||||||||||||
# Optionally, mark the current deployment with version (e.g. add git commit hash during docker building). | ||||||||||||||||||||||||||||||||||||||||
release=release, | ||||||||||||||||||||||||||||||||||||||||
metadata=metadata, | ||||||||||||||||||||||||||||||||||||||||
tags=tags, | ||||||||||||||||||||||||||||||||||||||||
|
@@ -342,6 +342,10 @@ def update_langfuse_trace_by_processed_market( | |||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
@property | ||||||||||||||||||||||||||||||||||||||||
def agent_name(self) -> str: | ||||||||||||||||||||||||||||||||||||||||
return self.__class__.__name__ | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
def check_min_required_balance_to_operate(self, market_type: MarketType) -> None: | ||||||||||||||||||||||||||||||||||||||||
api_keys = APIKeys() | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
@@ -441,10 +445,13 @@ def after_process_market( | |||||||||||||||||||||||||||||||||||||||
market_type: MarketType, | ||||||||||||||||||||||||||||||||||||||||
market: AgentMarket, | ||||||||||||||||||||||||||||||||||||||||
processed_market: ProcessedMarket | None, | ||||||||||||||||||||||||||||||||||||||||
agent_name: str, | ||||||||||||||||||||||||||||||||||||||||
gabrielfior marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
) -> None: | ||||||||||||||||||||||||||||||||||||||||
keys = APIKeys() | ||||||||||||||||||||||||||||||||||||||||
if self.store_prediction: | ||||||||||||||||||||||||||||||||||||||||
market.store_prediction(processed_market=processed_market, keys=keys) | ||||||||||||||||||||||||||||||||||||||||
market.store_prediction( | ||||||||||||||||||||||||||||||||||||||||
processed_market=processed_market, keys=keys, agent_name=self.agent_name | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused parameter agent_name The method accepts def after_process_market(
self,
market_type: MarketType,
market: AgentMarket,
processed_market: ProcessedMarket | None,
- agent_name: str,
) -> None:
keys = APIKeys()
if self.store_prediction:
market.store_prediction(
processed_market=processed_market, keys=keys, agent_name=self.agent_name
) 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||
logger.info( | ||||||||||||||||||||||||||||||||||||||||
f"Prediction {processed_market} not stored because {self.store_prediction=}." | ||||||||||||||||||||||||||||||||||||||||
|
@@ -472,7 +479,9 @@ def process_markets(self, market_type: MarketType) -> None: | |||||||||||||||||||||||||||||||||||||||
for market in available_markets: | ||||||||||||||||||||||||||||||||||||||||
self.before_process_market(market_type, market) | ||||||||||||||||||||||||||||||||||||||||
processed_market = self.process_market(market_type, market) | ||||||||||||||||||||||||||||||||||||||||
self.after_process_market(market_type, market, processed_market) | ||||||||||||||||||||||||||||||||||||||||
self.after_process_market( | ||||||||||||||||||||||||||||||||||||||||
market_type, market, processed_market, self.agent_name | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if processed_market is not None: | ||||||||||||||||||||||||||||||||||||||||
processed += 1 | ||||||||||||||||||||||||||||||||||||||||
|
@@ -611,12 +620,15 @@ def after_process_market( | |||||||||||||||||||||||||||||||||||||||
market_type: MarketType, | ||||||||||||||||||||||||||||||||||||||||
market: AgentMarket, | ||||||||||||||||||||||||||||||||||||||||
processed_market: ProcessedMarket | None, | ||||||||||||||||||||||||||||||||||||||||
agent_name: str, | ||||||||||||||||||||||||||||||||||||||||
gabrielfior marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
) -> None: | ||||||||||||||||||||||||||||||||||||||||
api_keys = APIKeys() | ||||||||||||||||||||||||||||||||||||||||
super().after_process_market(market_type, market, processed_market) | ||||||||||||||||||||||||||||||||||||||||
super().after_process_market( | ||||||||||||||||||||||||||||||||||||||||
market_type, market, processed_market, self.agent_name | ||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||
if isinstance(processed_market, ProcessedTradedMarket): | ||||||||||||||||||||||||||||||||||||||||
if self.store_trades: | ||||||||||||||||||||||||||||||||||||||||
market.store_trades(processed_market, api_keys) | ||||||||||||||||||||||||||||||||||||||||
market.store_trades(processed_market, api_keys, self.agent_name) | ||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||
logger.info( | ||||||||||||||||||||||||||||||||||||||||
f"Trades {processed_market.trades} not stored because {self.store_trades=}." | ||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider making agent_name more configurable
While the current implementation works, consider making it more flexible by allowing subclasses to customize their agent name, either through constructor parameter or class attribute.