|
803 | 803 | " support custom classes as parameters like Claudette does.\n", |
804 | 804 | "\n", |
805 | 805 | " Returns payment status response\"\"\"\n", |
| 806 | + " if isinstance(l402_offer, dict): l402_offer = L402Offers.from_dict(l402_offer)\n", |
806 | 807 | " offer_dict = l402_offer.as_dict()\n", |
807 | 808 | " data = {\"offer_id\": offer_id, **offer_dict}\n", |
808 | 809 | " return self._request(\"POST\", \"v0/l402/purchases/from-offer\", json=data)\n" |
|
818 | 819 | "result = fs.pay_offer(offer_id, l402)" |
819 | 820 | ] |
820 | 821 | }, |
821 | | - { |
822 | | - "cell_type": "code", |
823 | | - "execution_count": null, |
824 | | - "metadata": {}, |
825 | | - "outputs": [ |
826 | | - { |
827 | | - "data": { |
828 | | - "text/plain": [ |
829 | | - "{'name': 'pay_offer',\n", |
830 | | - " 'description': 'Pays an offer_id from the l402_offers. This tools requires the LLM caller to \\n support custom classes as parameters like Claudette does.\\n\\n Returns payment status response\\n\\nReturns:\\n- type: object',\n", |
831 | | - " 'input_schema': {'type': 'object',\n", |
832 | | - " 'properties': {'offer_id': {'type': 'string',\n", |
833 | | - " 'description': 'the offer id to pay for'},\n", |
834 | | - " 'l402_offer': {'type': 'object',\n", |
835 | | - " 'description': 'a dictionary containing L402 offers',\n", |
836 | | - " '$ref': '#/$defs/L402Offers'}},\n", |
837 | | - " 'title': None,\n", |
838 | | - " 'required': ['offer_id', 'l402_offer'],\n", |
839 | | - " '$defs': {'L402Offers': {'type': 'object',\n", |
840 | | - " 'properties': {'offers': {'type': 'array',\n", |
841 | | - " 'description': '',\n", |
842 | | - " 'items': {'$ref': '#/$defs/Offer'}},\n", |
843 | | - " 'payment_context_token': {'type': 'string', 'description': ''},\n", |
844 | | - " 'payment_request_url': {'type': 'string', 'description': ''},\n", |
845 | | - " 'version': {'type': 'string', 'description': ''}},\n", |
846 | | - " 'title': 'L402Offers',\n", |
847 | | - " 'required': ['offers',\n", |
848 | | - " 'payment_context_token',\n", |
849 | | - " 'payment_request_url',\n", |
850 | | - " 'version'],\n", |
851 | | - " '$defs': {'Offer': {'type': 'object',\n", |
852 | | - " 'properties': {'offer_id': {'type': 'string', 'description': ''},\n", |
853 | | - " 'amount': {'type': 'integer', 'description': ''},\n", |
854 | | - " 'currency': {'type': 'string', 'description': ''},\n", |
855 | | - " 'description': {'type': 'string', 'description': ''},\n", |
856 | | - " 'title': {'type': 'string', 'description': ''},\n", |
857 | | - " 'payment_methods': {'type': 'array',\n", |
858 | | - " 'description': '',\n", |
859 | | - " 'items': {'type': 'string'},\n", |
860 | | - " 'default': None},\n", |
861 | | - " 'type': {'type': 'string', 'description': '', 'default': 'one-off'}},\n", |
862 | | - " 'title': 'Offer',\n", |
863 | | - " 'required': ['offer_id',\n", |
864 | | - " 'amount',\n", |
865 | | - " 'currency',\n", |
866 | | - " 'description',\n", |
867 | | - " 'title']}}}}}}" |
868 | | - ] |
869 | | - }, |
870 | | - "execution_count": null, |
871 | | - "metadata": {}, |
872 | | - "output_type": "execute_result" |
873 | | - } |
874 | | - ], |
875 | | - "source": [ |
876 | | - "from toolslm.funccall import get_schema\n", |
877 | | - "get_schema(fs.pay_offer)" |
878 | | - ] |
879 | | - }, |
880 | 822 | { |
881 | 823 | "cell_type": "markdown", |
882 | 824 | "metadata": {}, |
|
0 commit comments