Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "virtuals-acp"
version = "0.3.18"
version = "0.3.19"
description = "Agent Commerce Protocol Python SDK by Virtuals"
authors = ["Steven Lee Soon Fatt <steven@virtuals.io>"]
readme = "README.md"
Expand Down
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