import builtins import json from typing import Optional, Type, Union from langchain_core.callbacks import AsyncCallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType class ValueSchema(BaseModel): """Schema for value operations.""" type: OperationType = Field(...) path: str = Field(..., description="Blockchain reference path") value: Optional[Union[int, str, float, dict]] = Field( None, description="Value to be set at the path" ) class AINValueOps(AINBaseTool): """Tool for value operations.""" name: str = "AINvalueOps" description: str = """ Covers the read and write value for the AINetwork Blockchain database. ## SET - Set a value at a given path ### Example - type: SET - path: /apps/langchain_test_1/object - value: {1: 2, "34": 56} ## GET - Retrieve a value at a given path ### Example - type: GET - path: /apps/langchain_test_1/DB ## Special paths - `/accounts/
/balance`: Account balance - `/accounts//nonce`: Account nonce - `/apps`: Applications - `/consensus`: Consensus - `/checkin`: Check-in - `/deposit/