oracle-ads 2.11.19__py3-none-any.whl → 2.12.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. ads/aqua/config/evaluation/evaluation_service_config.py +1 -0
  2. ads/aqua/extension/model_handler.py +17 -21
  3. ads/aqua/model/constants.py +3 -1
  4. ads/llm/__init__.py +10 -4
  5. ads/llm/chat_template.py +31 -0
  6. ads/llm/guardrails/base.py +3 -2
  7. ads/llm/guardrails/huggingface.py +1 -1
  8. ads/llm/langchain/plugins/chat_models/__init__.py +5 -0
  9. ads/llm/langchain/plugins/chat_models/oci_data_science.py +924 -0
  10. ads/llm/langchain/plugins/llms/__init__.py +5 -0
  11. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +939 -0
  12. ads/llm/requirements.txt +2 -2
  13. ads/llm/serialize.py +3 -6
  14. ads/llm/templates/tool_chat_template_hermes.jinja +130 -0
  15. ads/llm/templates/tool_chat_template_mistral_parallel.jinja +94 -0
  16. ads/opctl/operator/lowcode/anomaly/const.py +7 -2
  17. ads/opctl/operator/lowcode/anomaly/model/autots.py +30 -35
  18. ads/opctl/operator/lowcode/anomaly/model/factory.py +9 -8
  19. ads/opctl/operator/lowcode/anomaly/schema.yaml +8 -2
  20. ads/opctl/operator/lowcode/forecast/MLoperator +3 -3
  21. ads/opctl/operator/lowcode/forecast/model/automlx.py +1 -1
  22. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +1 -1
  23. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/METADATA +6 -4
  24. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/RECORD +27 -25
  25. ads/llm/langchain/plugins/base.py +0 -118
  26. ads/llm/langchain/plugins/contant.py +0 -44
  27. ads/llm/langchain/plugins/embeddings.py +0 -64
  28. ads/llm/langchain/plugins/llm_gen_ai.py +0 -301
  29. ads/llm/langchain/plugins/llm_md.py +0 -316
  30. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/LICENSE.txt +0 -0
  31. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/WHEEL +0 -0
  32. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/entry_points.txt +0 -0
@@ -18,7 +18,7 @@ ads/aqua/config/config.py,sha256=YIbd_9yP5kZd3G2q4q0TM6hzMdJSQ8BHPRAFE_5Xk3s,154
18
18
  ads/aqua/config/deployment_config_defaults.json,sha256=1fzb8EZOcFMjwktes40qgetKvdmUtEGCl4Jp4eb8tJg,665
19
19
  ads/aqua/config/resource_limit_names.json,sha256=0ecGLCLxll9qt3E7fVZPtzpurqe1PGdTk0Rjn_cWh8k,235
20
20
  ads/aqua/config/evaluation/__init__.py,sha256=2a_1LI4jWtJpbic5_v4EoOUTXCAH7cmsy9BW5prDHjU,179
21
- ads/aqua/config/evaluation/evaluation_service_config.py,sha256=JAaK_2dSVyoGv22PkjGgzMbt9WLBaZAOlk02yY3590k,8735
21
+ ads/aqua/config/evaluation/evaluation_service_config.py,sha256=i3yRcCiwCwVp-7YGWBWO7pPg2iWlN9Pz0upCSYOVVj4,8769
22
22
  ads/aqua/config/evaluation/evaluation_service_model_config.py,sha256=ITs_RBCynWuygjNdcUD7e2BLbPyPP3UozryEWlnju9s,280
23
23
  ads/aqua/config/utils/__init__.py,sha256=2a_1LI4jWtJpbic5_v4EoOUTXCAH7cmsy9BW5prDHjU,179
24
24
  ads/aqua/config/utils/serializer.py,sha256=RTyeFw2fDxmcTsERRd8AJDuyOuRQckL9dDLk8HFdxxc,11347
@@ -42,7 +42,7 @@ ads/aqua/extension/errors.py,sha256=i37EnRzxGgvxzUNoyEORzHYmB296DGOUb6pm7VwEyTU,
42
42
  ads/aqua/extension/evaluation_handler.py,sha256=RT2W7WDtxNIT0uirLfTcDlmTPYCuMuWRhiDxYZYliZs,4542
43
43
  ads/aqua/extension/evaluation_ws_msg_handler.py,sha256=dv0iwOSTxYj1kQ1rPEoDmGgFBzLUCLXq5h7rpmY2T1M,2098
44
44
  ads/aqua/extension/finetune_handler.py,sha256=ZCdXoEYzfViZfJsk0solCB6HQkg0skG1jFfqq1zF-vw,3312
45
- ads/aqua/extension/model_handler.py,sha256=usiyLPaJJLAjtDhyFCNseaT3AQelZkBkLwoCno4Uo1o,9079
45
+ ads/aqua/extension/model_handler.py,sha256=lsa8cRblUbITOtn2K9HuPWrl_CVGV2GXHq2aiGh4K5U,9130
46
46
  ads/aqua/extension/models_ws_msg_handler.py,sha256=3CPfzWl1xfrE2Dpn_WYP9zY0kY5zlsAE8tU_6Y2-i18,1801
47
47
  ads/aqua/extension/ui_handler.py,sha256=IYhtyL4oE8zlxe-kfbvWSmFsayyXaZZZButDdxM3hcA,9850
48
48
  ads/aqua/extension/ui_websocket_handler.py,sha256=oLFjaDrqkSERbhExdvxjLJX0oRcP-DVJ_aWn0qy0uvo,5084
@@ -54,7 +54,7 @@ ads/aqua/finetuning/constants.py,sha256=7LGF-rbbp-3IS8APjM9ABVHvm0EsaoC9A7XvxTgn
54
54
  ads/aqua/finetuning/entities.py,sha256=ZGFqewDV_YIGgmJqIXjrprSZE0yFZQF_tdbmQlvhTrQ,4045
55
55
  ads/aqua/finetuning/finetuning.py,sha256=5GXya26dmerhwlCxQ4TZJWZh5pr0h-TnkZ6WahJITvY,24497
56
56
  ads/aqua/model/__init__.py,sha256=j2iylvERdANxgrEDp7b_mLcKMz1CF5Go0qgYCiMwdos,278
57
- ads/aqua/model/constants.py,sha256=eUVl3FK8SRpfnDc1jNF09CkbWXyxmfTgW6Nqvus8lx0,1476
57
+ ads/aqua/model/constants.py,sha256=b2nszavi2fNGiMpfpqT5xPWpab_yTJUN_sEdC8gOG2M,1535
58
58
  ads/aqua/model/entities.py,sha256=5S2WFvDDt2XaQKYkWFAgs3P_g-VPpt74rpNQRM6-ssY,9580
59
59
  ads/aqua/model/enums.py,sha256=t8GbK2nblIPm3gClR8W31RmbtTuqpoSzoN4W3JfD6AI,1004
60
60
  ads/aqua/model/model.py,sha256=gMoELf_HjuUYYcW05XfNRghXk3IhBP0PPaQDgP_-QUA,54277
@@ -446,25 +446,27 @@ ads/jobs/templates/driver_pytorch.py,sha256=lZMokjQqcYVqTfXzhQYjc1Z-kXhmYgxZe3pg
446
446
  ads/jobs/templates/driver_utils.py,sha256=tFQOwdspi6eXNftFt1ZLtFChc3HQ37rdf3cQ4kf3ayg,22097
447
447
  ads/jobs/templates/hostname_from_env.c,sha256=SeEoIQnuCiP9fiYWJ5MokWBUi1u0mcSo-nTXbXyZp7w,2309
448
448
  ads/jobs/templates/oci_metrics.py,sha256=3l4h17W_dheSK34thp95pMvG0iqBufoXck3I8_4zX6I,5859
449
- ads/llm/__init__.py,sha256=ku_cx5jqTcYQzEWU6lMisuK1PFJU9Jva6Ncq8VpnrBI,714
449
+ ads/llm/__init__.py,sha256=t5yoDsD5huaEp38qdI5iTtkfXmJQ-5XDSrvcHM_XnHU,830
450
450
  ads/llm/chain.py,sha256=KuQcZGQsrlcl3CjtLk8KOHtSu0XJvFRL_Wv0Gz2RdF4,9526
451
+ ads/llm/chat_template.py,sha256=t2QRfLLR_c_cq3JqABghWqiCSWjjuVc_mfEN-yVYG10,934
451
452
  ads/llm/deploy.py,sha256=VYm_8ML8iXL_y-G8LqSm1VsQQTSFq7rA95VCdhLz1A0,1985
452
- ads/llm/requirements.txt,sha256=ZOtrHBFR6A5LCly-nqbwGD7iWTBVHIWRPrAejN3oQl0,65
453
- ads/llm/serialize.py,sha256=C5Zo8NjO1iAJ4De9tuOB8bQO-5Bcp6VszSULA46LOOM,7423
453
+ ads/llm/requirements.txt,sha256=vaVwhWCteqmo0fRsEk6M8S1LQMjULU_Bt_syBAa2G-s,55
454
+ ads/llm/serialize.py,sha256=WjQNMPACyR8nIh1dB7BLFUmqUrumld6vt91lg1DWzWI,7281
454
455
  ads/llm/guardrails/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
455
- ads/llm/guardrails/base.py,sha256=3z_gSik-d859fvDGe4UGjSon_aeqE0PqZwHOCS_89J0,16491
456
- ads/llm/guardrails/huggingface.py,sha256=ts54JD6AUgXu7HoqYYU6NCQhwdhlWl0DSxuQ9ZRCQ3k,1314
456
+ ads/llm/guardrails/base.py,sha256=UESjl8VgQGnDwpf8dy0PWpOJxpZKKnGHN6s46qnQUNw,16512
457
+ ads/llm/guardrails/huggingface.py,sha256=4DFanCYb3R1SKYSFdcEyGH2ywQgf2yFDDZGJtOcoph0,1304
457
458
  ads/llm/langchain/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
458
459
  ads/llm/langchain/plugins/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
459
- ads/llm/langchain/plugins/base.py,sha256=fmcI7KRCzh1Y-k7FbTzS-3WyAGomanFK0ZPZcqPIkFA,4704
460
- ads/llm/langchain/plugins/contant.py,sha256=p1k9p7LwITygnZttNRauato1PhybUPESnIcZv3kkqLY,1008
461
- ads/llm/langchain/plugins/embeddings.py,sha256=nOm902vY1P1oV6v1M7o9Fh0lSc7Gg0Nj5-puOByO6xI,2046
462
- ads/llm/langchain/plugins/llm_gen_ai.py,sha256=HeFHUV1aqdw661VoyYdjG973m-LntU0YWozOZ9YEKi0,9975
463
- ads/llm/langchain/plugins/llm_md.py,sha256=YhlT1gu4BZShcdQ4sy6S9N4h9BC-FqSbvYTAVoHkgpw,9899
460
+ ads/llm/langchain/plugins/chat_models/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
461
+ ads/llm/langchain/plugins/chat_models/oci_data_science.py,sha256=q398lxXycKlAtPmkVqeEE-Uaqymj13HZIRaCm2B_xDU,33667
462
+ ads/llm/langchain/plugins/llms/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
463
+ ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py,sha256=ng3pEoXXEaCc_qSHkXwyJmZC9dGPO-imQT4JN6jAJnc,32353
464
464
  ads/llm/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
465
465
  ads/llm/serializers/retrieval_qa.py,sha256=VQ4rFRrDHOpAcMYNvRbT19LcDGwRrE1lczerLQYKxwU,5133
466
466
  ads/llm/serializers/runnable_parallel.py,sha256=USCVhMNi67AiCmu-s_mmOvc0sK7v4yKVwBTJm60x7wE,835
467
467
  ads/llm/templates/score_chain.jinja2,sha256=H6_riqJlFtnQk7Za4rb7wGffWVLEUxxqgXlsbMPdInY,4869
468
+ ads/llm/templates/tool_chat_template_hermes.jinja,sha256=nQgWGwZludNFmUO7V8emgPQud828l9T4e5QmsDyLq4k,5226
469
+ ads/llm/templates/tool_chat_template_mistral_parallel.jinja,sha256=xkZLgw50a3wPiw9I5HmDlZiEAXPg9wtwnrkhaAiI_1o,4773
468
470
  ads/model/__init__.py,sha256=r4U2NvroKMUa-tqNnXBtND9cA6b1Yefmdj6lgdoKlDk,1900
469
471
  ads/model/artifact.py,sha256=ONKyjZKO5wmAYI-GT63z8yLm_QsmIGXcob9KrnwtF5k,20503
470
472
  ads/model/artifact_downloader.py,sha256=-9IYkjZ0LaMWf5foz5HUGTZCEm67f-3LbDsigNlzEPg,9751
@@ -637,17 +639,17 @@ ads/opctl/operator/lowcode/anomaly/README.md,sha256=E3vpyc5iKvIq8iuvGj8ZvLq3i_Q5
637
639
  ads/opctl/operator/lowcode/anomaly/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
638
640
  ads/opctl/operator/lowcode/anomaly/__main__.py,sha256=q7TSFpSmLSAXlwjWNMi_M5y9ndF86RPd7KJ_kanltjM,3328
639
641
  ads/opctl/operator/lowcode/anomaly/cmd.py,sha256=e6ATBJcPXEdZ85hlSb7aWselA-8LlvtpI0AuO4Yw6Iw,1002
640
- ads/opctl/operator/lowcode/anomaly/const.py,sha256=nNZqjH-YNB2GVsk890v3B88pml15xrSOPjvfW2P5M1o,2930
642
+ ads/opctl/operator/lowcode/anomaly/const.py,sha256=XKJkWFkXy6BYPn68L0bopYOUUKbzOI_AyxBDEiGWgaM,3048
641
643
  ads/opctl/operator/lowcode/anomaly/environment.yaml,sha256=J6KiIHOb5a2AcgZm1sisMgbjABlizyYRUq_aYZBk228,156
642
644
  ads/opctl/operator/lowcode/anomaly/operator_config.py,sha256=A1LBD0n3_M6M_2NuFQ6FrLq4vukUL47iPbPDBkIS3OY,4328
643
- ads/opctl/operator/lowcode/anomaly/schema.yaml,sha256=jMSoCqb58Dz4_LeB55LO9_NRQ8TKPeVdl5VkGZHlqYs,9200
645
+ ads/opctl/operator/lowcode/anomaly/schema.yaml,sha256=j2JvCyCStZ3owDxAm7b_v0E5Hrx7gE6DbYv1hSjOxD4,9314
644
646
  ads/opctl/operator/lowcode/anomaly/utils.py,sha256=Uj98FO5oM-sLjoqsOnoBmgSMF7iJiL0XX-gvphw9yiU,2746
645
647
  ads/opctl/operator/lowcode/anomaly/model/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
646
648
  ads/opctl/operator/lowcode/anomaly/model/anomaly_dataset.py,sha256=zpRRAtbjRgX9HPJb_7-eZ96c1AGQgDjjs-CsLTvYtuY,5402
647
649
  ads/opctl/operator/lowcode/anomaly/model/automlx.py,sha256=Zn4ySrGfLbaKW0KIduwdnY0-YK8XAprCcMhElA4g-Vc,3401
648
- ads/opctl/operator/lowcode/anomaly/model/autots.py,sha256=WlA39DA3GeQfW5HYiBLCArVQBXGzIVQH3D09cZYGjtg,3689
650
+ ads/opctl/operator/lowcode/anomaly/model/autots.py,sha256=Q9FjVIOjnyctGDvYWCMB_rtusbl5IK1wCzkVze_MKxw,3984
649
651
  ads/opctl/operator/lowcode/anomaly/model/base_model.py,sha256=bq2VgRxLIRFov8pEoYCPGw3AXUmTJktA2nszQN8La2c,15365
650
- ads/opctl/operator/lowcode/anomaly/model/factory.py,sha256=XEh5bdnWDjIEBswrOb36CeTmRcWQ2uUGDrC3e3iJVxY,3264
652
+ ads/opctl/operator/lowcode/anomaly/model/factory.py,sha256=uRVD44_VCJVJzr3s3Cy_fPpYyP45JwKRmmN7uE2lw3I,3450
651
653
  ads/opctl/operator/lowcode/anomaly/model/isolationforest.py,sha256=Kjsuio7cM-dKv63p58B9Jj0XPly6Z0hqfghs5nnXepA,2671
652
654
  ads/opctl/operator/lowcode/anomaly/model/oneclasssvm.py,sha256=eQpNyax1hnufLHhL8Rbzee28comD2fF7TLn3TpzMrs8,2583
653
655
  ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py,sha256=HUyWQOFjfLkIWsnmhfEn9354slKStlv6jIwQi5xzVj0,4270
@@ -672,7 +674,7 @@ ads/opctl/operator/lowcode/feature_store_marketplace/models/apigw_config.py,sha2
672
674
  ads/opctl/operator/lowcode/feature_store_marketplace/models/db_config.py,sha256=ush-EZ9TUSg00g0Px-4SJa83KNLlV3BgQl9PNkVQC7M,1249
673
675
  ads/opctl/operator/lowcode/feature_store_marketplace/models/mysql_config.py,sha256=wLifggnPo6d10SxkgVbGHB5L-EdV4QaO_BvBzpeTZGQ,3268
674
676
  ads/opctl/operator/lowcode/feature_store_marketplace/models/serializable_yaml_model.py,sha256=Fd5K1q30mIyCbU6WDH8nDXyCJFlo_kSAEKxqr4dQSSc,1135
675
- ads/opctl/operator/lowcode/forecast/MLoperator,sha256=i0H5hvZsYYFf8pP9997ulcU4gD5q8K2yeyUSicJOHsk,5973
677
+ ads/opctl/operator/lowcode/forecast/MLoperator,sha256=xM8yBUQObjG_6Mg36f3Vv8b9N3L8_5RUZJE2riOjXuw,5981
676
678
  ads/opctl/operator/lowcode/forecast/README.md,sha256=kbCCEdo-0pwKlZp9ctnWUK6Z31n69IsnG0i26b202Zg,9768
677
679
  ads/opctl/operator/lowcode/forecast/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
678
680
  ads/opctl/operator/lowcode/forecast/__main__.py,sha256=5Vh-kClwxTsvZLEuECyQBvbZFfH37HQW2G09RwX11Kw,2503
@@ -686,11 +688,11 @@ ads/opctl/operator/lowcode/forecast/schema.yaml,sha256=Zfhh_wfWxNeTtN4bqAe623Vf0
686
688
  ads/opctl/operator/lowcode/forecast/utils.py,sha256=oc6eBH9naYg4BB14KS2HL0uFdZHMgKsxx9vG28dJrXA,14347
687
689
  ads/opctl/operator/lowcode/forecast/model/__init__.py,sha256=sAqmLhogrLXb3xI7dPOj9HmSkpTnLh9wkzysuGd8AXk,204
688
690
  ads/opctl/operator/lowcode/forecast/model/arima.py,sha256=6ZXtzXcqoEMVF9DChzX0cnTJ-9tXKdbPiiSPQq4a9oM,10914
689
- ads/opctl/operator/lowcode/forecast/model/automlx.py,sha256=nMqljeHnhuYGMmRa8e0PkDtx-ClSclQeJVowBIkq0Sk,14848
691
+ ads/opctl/operator/lowcode/forecast/model/automlx.py,sha256=D7U-y-sTdkiqynk_l86z1HNSjn9c58DJTU7l8T33BJk,14856
690
692
  ads/opctl/operator/lowcode/forecast/model/autots.py,sha256=QxU24eZeaRpnC5rTqBFe6-5ylMorPN0sCamHUiNQVaE,13162
691
693
  ads/opctl/operator/lowcode/forecast/model/base_model.py,sha256=s4_lvasasCqvrj49ubD0H_2wA9pvh16_f5BiivqvL20,30876
692
694
  ads/opctl/operator/lowcode/forecast/model/factory.py,sha256=NV_m2sEgj3byHHqLs9Vbth7d5yfvFuXj8QI3-y9x2Po,3488
693
- ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py,sha256=d9rDmrIAbKTStOVroIKZkTEP1FP2AP0dq9XDEWt6w2c,16968
695
+ ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py,sha256=02gOA-0KKtD0VYj87SsgRMq4EP2VSnhfuxoH1suAIO0,16968
694
696
  ads/opctl/operator/lowcode/forecast/model/ml_forecast.py,sha256=EOFZR5wjZcpKACW3ZNnxd31Okz_ehOSaO5_dKL-Ktgw,9558
695
697
  ads/opctl/operator/lowcode/forecast/model/neuralprophet.py,sha256=pRmhLHjP027gmPbkgqzR2SZYKvj1rG9Heev2P8mSZ_k,19347
696
698
  ads/opctl/operator/lowcode/forecast/model/prophet.py,sha256=0OBnyVP9bFpo1zSAqA5qtobZxICRTLVT9mwPOlHb3sM,14554
@@ -811,8 +813,8 @@ ads/type_discovery/unknown_detector.py,sha256=yZuYQReO7PUyoWZE7onhhtYaOg6088wf1y
811
813
  ads/type_discovery/zipcode_detector.py,sha256=3AlETg_ZF4FT0u914WXvTT3F3Z6Vf51WiIt34yQMRbw,1421
812
814
  ads/vault/__init__.py,sha256=x9tMdDAOdF5iDHk9u2di_K-ze5Nq068x25EWOBoWwqY,245
813
815
  ads/vault/vault.py,sha256=hFBkpYE-Hfmzu1L0sQwUfYcGxpWmgG18JPndRl0NOXI,8624
814
- oracle_ads-2.11.19.dist-info/entry_points.txt,sha256=9VFnjpQCsMORA4rVkvN8eH6D3uHjtegb9T911t8cqV0,35
815
- oracle_ads-2.11.19.dist-info/LICENSE.txt,sha256=zoGmbfD1IdRKx834U0IzfFFFo5KoFK71TND3K9xqYqo,1845
816
- oracle_ads-2.11.19.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
817
- oracle_ads-2.11.19.dist-info/METADATA,sha256=R8jk8MKEE5pas8WxbiX_VJ02VbhhojP_R83HgtIKUmE,16068
818
- oracle_ads-2.11.19.dist-info/RECORD,,
816
+ oracle_ads-2.12.1.dist-info/entry_points.txt,sha256=9VFnjpQCsMORA4rVkvN8eH6D3uHjtegb9T911t8cqV0,35
817
+ oracle_ads-2.12.1.dist-info/LICENSE.txt,sha256=zoGmbfD1IdRKx834U0IzfFFFo5KoFK71TND3K9xqYqo,1845
818
+ oracle_ads-2.12.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
819
+ oracle_ads-2.12.1.dist-info/METADATA,sha256=5I5Ky6jb3u3gyBOYwjEu4ov9lwZAme6eaE7A_wcotMo,16150
820
+ oracle_ads-2.12.1.dist-info/RECORD,,
@@ -1,118 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
-
4
- # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
- # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
- from typing import Any, Dict, List, Optional
7
-
8
- from langchain.llms.base import LLM
9
- from langchain.pydantic_v1 import BaseModel, Field, root_validator
10
-
11
- from ads import logger
12
- from ads.common.auth import default_signer
13
- from ads.config import COMPARTMENT_OCID
14
-
15
-
16
- class BaseLLM(LLM):
17
- """Base OCI LLM class. Contains common attributes."""
18
-
19
- auth: dict = Field(default_factory=default_signer, exclude=True)
20
- """ADS auth dictionary for OCI authentication.
21
- This can be generated by calling `ads.common.auth.api_keys()` or `ads.common.auth.resource_principal()`.
22
- If this is not provided then the `ads.common.default_signer()` will be used."""
23
-
24
- max_tokens: int = 256
25
- """Denotes the number of tokens to predict per generation."""
26
-
27
- temperature: float = 0.2
28
- """A non-negative float that tunes the degree of randomness in generation."""
29
-
30
- k: int = 0
31
- """Number of most likely tokens to consider at each step."""
32
-
33
- p: int = 0.75
34
- """Total probability mass of tokens to consider at each step."""
35
-
36
- stop: Optional[List[str]] = None
37
- """Stop words to use when generating. Model output is cut off at the first occurrence of any of these substrings."""
38
-
39
- def _print_request(self, prompt, params):
40
- if self.verbose:
41
- print(f"LLM API Request:\n{prompt}")
42
-
43
- def _print_response(self, completion, response):
44
- if self.verbose:
45
- print(f"LLM API Completion:\n{completion}")
46
-
47
- @classmethod
48
- def get_lc_namespace(cls) -> List[str]:
49
- """Get the namespace of the LangChain object."""
50
- return ["ads", "llm"]
51
-
52
- @classmethod
53
- def is_lc_serializable(cls) -> bool:
54
- """This class can be serialized with default LangChain serialization."""
55
- return True
56
-
57
-
58
- class GenerativeAiClientModel(BaseModel):
59
- """Base model for generative AI embedding model and LLM."""
60
-
61
- # This auth is the same as the auth in BaseLLM class.
62
- # However, this is needed for the Gen AI embedding model.
63
- # Do not remove this attribute
64
- auth: dict = Field(default_factory=default_signer, exclude=True)
65
- """ADS auth dictionary for OCI authentication.
66
- This can be generated by calling `ads.common.auth.api_keys()` or `ads.common.auth.resource_principal()`.
67
- If this is not provided then the `ads.common.default_signer()` will be used."""
68
-
69
- client: Any #: :meta private:
70
- """OCI GenerativeAiClient."""
71
-
72
- compartment_id: str = None
73
- """Compartment ID of the caller."""
74
-
75
- endpoint_kwargs: Dict[str, Any] = {}
76
- """Optional attributes passed to the OCI API call."""
77
-
78
- client_kwargs: Dict[str, Any] = {}
79
- """Holds any client parameters for creating GenerativeAiClient"""
80
-
81
- @staticmethod
82
- def _import_client():
83
- try:
84
- from oci.generative_ai_inference import GenerativeAiInferenceClient
85
- except ImportError as ex:
86
- raise ImportError(
87
- "Could not import GenerativeAiInferenceClient from oci. "
88
- "The OCI SDK installed does not support generative AI service."
89
- ) from ex
90
- return GenerativeAiInferenceClient
91
-
92
- @root_validator()
93
- def validate_environment( # pylint: disable=no-self-argument
94
- cls, values: Dict
95
- ) -> Dict:
96
- """Validate that python package exists in environment."""
97
- # Initialize client only if user does not pass in client.
98
- # Users may choose to initialize the OCI client by themselves and pass it into this model.
99
- logger.warning(
100
- f"The ads langchain plugin {cls.__name__} will be deprecated soon. "
101
- "Please refer to https://python.langchain.com/v0.2/docs/integrations/providers/oci/ "
102
- "for the latest support."
103
- )
104
- if not values.get("client"):
105
- auth = values.get("auth", {})
106
- client_kwargs = auth.get("client_kwargs") or {}
107
- client_kwargs.update(values["client_kwargs"])
108
- # Import the GenerativeAIClient here so that there will be no error when user import ads.llm
109
- # and the install OCI SDK does not support generative AI service yet.
110
- client_class = cls._import_client()
111
- values["client"] = client_class(**auth, **client_kwargs)
112
- # Set default compartment ID
113
- if not values.get("compartment_id"):
114
- if COMPARTMENT_OCID:
115
- values["compartment_id"] = COMPARTMENT_OCID
116
- else:
117
- raise ValueError("Please specify compartment_id.")
118
- return values
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
-
4
- # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
- # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
- from enum import Enum
7
-
8
-
9
- class StrEnum(str, Enum):
10
- """Enum with string members
11
- https://docs.python.org/3.11/library/enum.html#enum.StrEnum
12
- """
13
-
14
- # Pydantic uses Python's standard enum classes to define choices.
15
- # https://docs.pydantic.dev/latest/api/standard_library_types/#enum
16
-
17
-
18
- DEFAULT_TIME_OUT = 300
19
- DEFAULT_CONTENT_TYPE_JSON = "application/json"
20
-
21
-
22
- class Task(StrEnum):
23
- TEXT_GENERATION = "text_generation"
24
- TEXT_SUMMARIZATION = "text_summarization"
25
-
26
-
27
- class LengthParam(StrEnum):
28
- SHORT = "SHORT"
29
- MEDIUM = "MEDIUM"
30
- LONG = "LONG"
31
- AUTO = "AUTO"
32
-
33
-
34
- class FormatParam(StrEnum):
35
- PARAGRAPH = "PARAGRAPH"
36
- BULLETS = "BULLETS"
37
- AUTO = "AUTO"
38
-
39
-
40
- class ExtractivenessParam(StrEnum):
41
- LOW = "LOW"
42
- MEDIUM = "MEDIUM"
43
- HIGH = "HIGH"
44
- AUTO = "AUTO"
@@ -1,64 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
-
4
- # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
- # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
-
7
- from typing import List, Optional
8
- from langchain.load.serializable import Serializable
9
- from langchain.schema.embeddings import Embeddings
10
- from ads.llm.langchain.plugins.base import GenerativeAiClientModel
11
-
12
-
13
- class GenerativeAIEmbeddings(GenerativeAiClientModel, Embeddings, Serializable):
14
- """OCI Generative AI embedding models."""
15
-
16
- model: str = "cohere.embed-english-light-v2.0"
17
- """Model name to use."""
18
-
19
- truncate: Optional[str] = None
20
- """Truncate embeddings that are too long from start or end ("NONE"|"START"|"END")"""
21
-
22
- @classmethod
23
- def get_lc_namespace(cls) -> List[str]:
24
- """Get the namespace of the LangChain object."""
25
- return ["ads", "llm"]
26
-
27
- @classmethod
28
- def is_lc_serializable(cls) -> bool:
29
- """This class can be serialized with default LangChain serialization."""
30
- return True
31
-
32
- def embed_documents(self, texts: List[str]) -> List[List[float]]:
33
- """Embeds a list of strings.
34
-
35
- Args:
36
- texts: The list of texts to embed.
37
-
38
- Returns:
39
- List of embeddings, one for each text.
40
- """
41
- from oci.generative_ai_inference.models import (
42
- EmbedTextDetails,
43
- OnDemandServingMode,
44
- )
45
-
46
- details = EmbedTextDetails(
47
- compartment_id=self.compartment_id,
48
- inputs=texts,
49
- serving_mode=OnDemandServingMode(model_id=self.model),
50
- truncate=self.truncate,
51
- )
52
- embeddings = self.client.embed_text(details).data.embeddings
53
- return [list(map(float, e)) for e in embeddings]
54
-
55
- def embed_query(self, text: str) -> List[float]:
56
- """Embeds a single string.
57
-
58
- Args:
59
- text: The text to embed.
60
-
61
- Returns:
62
- Embeddings for the text.
63
- """
64
- return self.embed_documents([text])[0]
@@ -1,301 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
-
4
- # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
- # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
-
7
- import logging
8
- from typing import Any, Dict, List, Optional
9
-
10
- from langchain.callbacks.manager import CallbackManagerForLLMRun
11
-
12
- from ads.llm.langchain.plugins.base import BaseLLM, GenerativeAiClientModel
13
- from ads.llm.langchain.plugins.contant import Task
14
-
15
- logger = logging.getLogger(__name__)
16
-
17
-
18
- class GenerativeAI(GenerativeAiClientModel, BaseLLM):
19
- """GenerativeAI Service.
20
-
21
- To use, you should have the ``oci`` python package installed.
22
-
23
- Example
24
- -------
25
-
26
- .. code-block:: python
27
-
28
- from ads.llm import GenerativeAI
29
-
30
- gen_ai = GenerativeAI(compartment_id="ocid1.compartment.oc1..<ocid>")
31
-
32
- """
33
-
34
- task: str = "text_generation"
35
- """Task can be either text_generation or text_summarization."""
36
-
37
- model: Optional[str] = "cohere.command"
38
- """Model name to use."""
39
-
40
- frequency_penalty: float = None
41
- """Penalizes repeated tokens according to frequency. Between 0 and 1."""
42
-
43
- presence_penalty: float = None
44
- """Penalizes repeated tokens. Between 0 and 1."""
45
-
46
- truncate: Optional[str] = None
47
- """Specify how the client handles inputs longer than the maximum token."""
48
-
49
- length: str = "AUTO"
50
- """Indicates the approximate length of the summary. """
51
-
52
- format: str = "PARAGRAPH"
53
- """Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points."""
54
-
55
- extractiveness: str = "AUTO"
56
- """Controls how close to the original text the summary is. High extractiveness summaries will lean towards reusing sentences verbatim, while low extractiveness summaries will tend to paraphrase more."""
57
-
58
- additional_command: str = ""
59
- """A free-form instruction for modifying how the summaries get generated. """
60
-
61
- @property
62
- def _identifying_params(self) -> Dict[str, Any]:
63
- """Get the identifying parameters."""
64
- return {
65
- **{
66
- "model": self.model,
67
- "task": self.task,
68
- "client_kwargs": self.client_kwargs,
69
- "endpoint_kwargs": self.endpoint_kwargs,
70
- },
71
- **self._default_params,
72
- }
73
-
74
- @property
75
- def _llm_type(self) -> str:
76
- """Return type of llm."""
77
- return "GenerativeAI"
78
-
79
- @property
80
- def _default_params(self) -> Dict[str, Any]:
81
- """Get the default parameters for calling OCIGenerativeAI API."""
82
- # This property is used by _identifying_params(), which then used for serialization
83
- # All parameters returning here should be JSON serializable.
84
-
85
- return (
86
- {
87
- "compartment_id": self.compartment_id,
88
- "temperature": self.temperature,
89
- "max_tokens": self.max_tokens,
90
- "top_k": self.k,
91
- "top_p": self.p,
92
- "frequency_penalty": self.frequency_penalty,
93
- "presence_penalty": self.presence_penalty,
94
- "truncate": self.truncate,
95
- }
96
- if self.task == Task.TEXT_GENERATION
97
- else {
98
- "compartment_id": self.compartment_id,
99
- "temperature": self.temperature,
100
- "length": self.length,
101
- "format": self.format,
102
- "extractiveness": self.extractiveness,
103
- "additional_command": self.additional_command,
104
- }
105
- )
106
-
107
- def _invocation_params(self, stop: Optional[List[str]], **kwargs: Any) -> dict:
108
- params = self._default_params
109
- if self.task == Task.TEXT_SUMMARIZATION:
110
- return {**params}
111
-
112
- if self.stop is not None and stop is not None:
113
- raise ValueError("`stop` found in both the input and default params.")
114
- elif self.stop is not None:
115
- params["stop_sequences"] = self.stop
116
- else:
117
- params["stop_sequences"] = stop
118
- return {**params, **kwargs}
119
-
120
- def _call(
121
- self,
122
- prompt: str,
123
- stop: Optional[List[str]] = None,
124
- run_manager: Optional[CallbackManagerForLLMRun] = None,
125
- **kwargs: Any,
126
- ):
127
- """Call out to GenerativeAI's generate endpoint.
128
-
129
- Parameters
130
- ----------
131
- prompt (str):
132
- The prompt to pass into the model.
133
- stop (List[str], Optional):
134
- List of stop words to use when generating.
135
-
136
- Returns
137
- -------
138
- The string generated by the model.
139
-
140
- Example
141
- -------
142
-
143
- .. code-block:: python
144
-
145
- response = gen_ai("Tell me a joke.")
146
- """
147
-
148
- params = self._invocation_params(stop, **kwargs)
149
- self._print_request(prompt, params)
150
-
151
- try:
152
- completion = self.completion_with_retry(prompt=prompt, **params)
153
- except Exception:
154
- logger.error(
155
- "Error occur when invoking oci service api."
156
- "DEBUG INTO: task=%s, params=%s, prompt=%s",
157
- self.task,
158
- params,
159
- prompt,
160
- )
161
- raise
162
-
163
- return completion
164
-
165
- def _text_generation(self, request_class, serving_mode, **kwargs):
166
- from oci.generative_ai_inference.models import (
167
- GenerateTextDetails,
168
- GenerateTextResult,
169
- )
170
-
171
- compartment_id = kwargs.pop("compartment_id")
172
- inference_request = request_class(**kwargs)
173
- response = self.client.generate_text(
174
- GenerateTextDetails(
175
- compartment_id=compartment_id,
176
- serving_mode=serving_mode,
177
- inference_request=inference_request,
178
- ),
179
- **self.endpoint_kwargs,
180
- ).data
181
- response: GenerateTextResult
182
- return response.inference_response
183
-
184
- def _cohere_completion(self, serving_mode, **kwargs) -> str:
185
- from oci.generative_ai_inference.models import (
186
- CohereLlmInferenceRequest,
187
- CohereLlmInferenceResponse,
188
- )
189
-
190
- response = self._text_generation(
191
- CohereLlmInferenceRequest, serving_mode, **kwargs
192
- )
193
- response: CohereLlmInferenceResponse
194
- if kwargs.get("num_generations", 1) == 1:
195
- completion = response.generated_texts[0].text
196
- else:
197
- completion = [result.text for result in response.generated_texts]
198
- self._print_response(completion, response)
199
- return completion
200
-
201
- def _llama_completion(self, serving_mode, **kwargs) -> str:
202
- from oci.generative_ai_inference.models import (
203
- LlamaLlmInferenceRequest,
204
- LlamaLlmInferenceResponse,
205
- )
206
-
207
- # truncate and stop_sequence are not supported.
208
- kwargs.pop("truncate", None)
209
- kwargs.pop("stop_sequences", None)
210
- # top_k must be >1 or -1
211
- if "top_k" in kwargs and kwargs["top_k"] == 0:
212
- kwargs.pop("top_k")
213
-
214
- # top_p must be 1 when temperature is 0
215
- if kwargs.get("temperature") == 0:
216
- kwargs["top_p"] = 1
217
-
218
- response = self._text_generation(
219
- LlamaLlmInferenceRequest, serving_mode, **kwargs
220
- )
221
- response: LlamaLlmInferenceResponse
222
- if kwargs.get("num_generations", 1) == 1:
223
- completion = response.choices[0].text
224
- else:
225
- completion = [result.text for result in response.choices]
226
- self._print_response(completion, response)
227
- return completion
228
-
229
- def _cohere_summarize(self, serving_mode, **kwargs) -> str:
230
- from oci.generative_ai_inference.models import SummarizeTextDetails
231
-
232
- kwargs["input"] = kwargs.pop("prompt")
233
-
234
- response = self.client.summarize_text(
235
- SummarizeTextDetails(serving_mode=serving_mode, **kwargs),
236
- **self.endpoint_kwargs,
237
- )
238
- return response.data.summary
239
-
240
- def completion_with_retry(self, **kwargs: Any) -> Any:
241
- from oci.generative_ai_inference.models import OnDemandServingMode
242
-
243
- serving_mode = OnDemandServingMode(model_id=self.model)
244
-
245
- if self.task == Task.TEXT_SUMMARIZATION:
246
- return self._cohere_summarize(serving_mode, **kwargs)
247
- elif self.model.startswith("cohere"):
248
- return self._cohere_completion(serving_mode, **kwargs)
249
- elif self.model.startswith("meta.llama"):
250
- return self._llama_completion(serving_mode, **kwargs)
251
- raise ValueError(f"Model {self.model} is not supported.")
252
-
253
- def batch_completion(
254
- self,
255
- prompt: str,
256
- stop: Optional[List[str]] = None,
257
- run_manager: Optional[CallbackManagerForLLMRun] = None,
258
- num_generations: int = 1,
259
- **kwargs: Any,
260
- ) -> List[str]:
261
- """Generates multiple completion for the given prompt.
262
-
263
- Parameters
264
- ----------
265
- prompt (str):
266
- The prompt to pass into the model.
267
- stop: (List[str], optional):
268
- Optional list of stop words to use when generating. Defaults to None.
269
- num_generations (int, optional):
270
- Number of completions aims to get. Defaults to 1.
271
-
272
- Raises
273
- ------
274
- NotImplementedError
275
- Raise when invoking batch_completion under summarization task.
276
-
277
- Returns
278
- -------
279
- List[str]
280
- List of multiple completions.
281
-
282
- Example
283
- -------
284
-
285
- .. code-block:: python
286
-
287
- responses = gen_ai.batch_completion("Tell me a joke.", num_generations=5)
288
-
289
- """
290
- if self.task == Task.TEXT_SUMMARIZATION:
291
- raise NotImplementedError(
292
- f"task={Task.TEXT_SUMMARIZATION} does not support batch_completion. "
293
- )
294
-
295
- return self._call(
296
- prompt=prompt,
297
- stop=stop,
298
- run_manager=run_manager,
299
- num_generations=num_generations,
300
- **kwargs,
301
- )