diff --git a/pyproject.toml b/pyproject.toml index 5bdcf88..e7227f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] readme = "README.md" diff --git a/virtuals_acp/client.py b/virtuals_acp/client.py index 4673b4b..4f14b0d 100644 --- a/virtuals_acp/client.py +++ b/virtuals_acp/client.py @@ -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 @@ -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), ) ) diff --git a/virtuals_acp/job_offering.py b/virtuals_acp/job_offering.py index d806ca3..91ec376 100644 --- a/virtuals_acp/job_offering.py +++ b/virtuals_acp/job_offering.py @@ -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