Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 10 additions & 8 deletions virtuals_acp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,12 @@ def _hydrate_agent(self, agent_data: Dict[str, Any]) -> IACPAgent:
provider_address = agent_data.get("walletAddress")

job_offerings: List[ACPJobOffering] = []
for job in agent_data.get("jobs", []):
if "priceV2" in job:
price = job["priceV2"]["value"]
price_type = PriceType(job["priceV2"]["type"])
elif "price" in job:
price = job["price"]
for offering in agent_data.get("jobs", []):
if "priceV2" in offering:
price = offering["priceV2"]["value"]
price_type = PriceType(offering["priceV2"]["type"])
elif "price" in offering:
price = offering["price"]
price_type = PriceType.FIXED
else:
continue
Expand All @@ -311,10 +311,12 @@ def _hydrate_agent(self, agent_data: Dict[str, Any]) -> IACPAgent:
acp_client=self,
contract_client=contract_client,
provider_address=provider_address,
name=job["name"],
name=offering["name"],
price=price,
price_type=price_type,
requirement=job.get("requirement", None),
required_funds=offering["requiredFunds"],
requirement=offering.get("requirement", None),
deliverable=offering.get("deliverable", None),
)
)

Expand Down
3 changes: 2 additions & 1 deletion virtuals_acp/job_offering.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class ACPJobOffering(BaseModel):
provider_address: str
name: str
price: float
price_type: PriceType = PriceType.FIXED
price_type: PriceType
required_funds: bool
requirement: Optional[Union[Dict[str, Any], str]] = None
deliverable: Optional[Union[Dict[str, Any], str]] = None

Expand Down