Aryan Jain commited on
Commit
3b89400
·
1 Parent(s): 8243757

change to openai library

Browse files
Files changed (4) hide show
  1. .env.example +4 -1
  2. poetry.lock +111 -1
  3. pyproject.toml +1 -0
  4. src/utils/_chat_client.py +12 -9
.env.example CHANGED
@@ -12,4 +12,7 @@ AZURE_TENANT_ID=
12
  AZURE_CLIENT_ID=
13
  AZURE_CLIENT_SECRET=
14
  AZURE_SCOPE=https://graph.microsoft.com/.default
15
- AZURE_DRIVE_ID=
 
 
 
 
12
  AZURE_CLIENT_ID=
13
  AZURE_CLIENT_SECRET=
14
  AZURE_SCOPE=https://graph.microsoft.com/.default
15
+ AZURE_DRIVE_ID=
16
+ OPENAI_BASE_URL=https://api.groq.com/openai/v1
17
+ OPENAI_API_KEY=
18
+ OPENAI_MODEL=
poetry.lock CHANGED
@@ -965,6 +965,91 @@ MarkupSafe = ">=2.0"
965
  [package.extras]
966
  i18n = ["Babel (>=2.7)"]
967
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
968
  [[package]]
969
  name = "joblib"
970
  version = "1.4.2"
@@ -1696,6 +1781,31 @@ files = [
1696
  {file = "nvidia_nvtx_cu12-12.4.127-py3-none-win_amd64.whl", hash = "sha256:641dccaaa1139f3ffb0d3164b4b84f9d253397e38246a4f2f36728b48566d485"},
1697
  ]
1698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1699
  [[package]]
1700
  name = "orjson"
1701
  version = "3.10.11"
@@ -3755,4 +3865,4 @@ propcache = ">=0.2.0"
3755
  [metadata]
3756
  lock-version = "2.0"
3757
  python-versions = "3.11.*"
3758
- content-hash = "1e767e2c2134a38970114f1e30b12177e933487c402fc6ca6057a8442f6d4c4f"
 
965
  [package.extras]
966
  i18n = ["Babel (>=2.7)"]
967
 
968
+ [[package]]
969
+ name = "jiter"
970
+ version = "0.8.2"
971
+ description = "Fast iterable JSON parser."
972
+ optional = false
973
+ python-versions = ">=3.8"
974
+ files = [
975
+ {file = "jiter-0.8.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:ca8577f6a413abe29b079bc30f907894d7eb07a865c4df69475e868d73e71c7b"},
976
+ {file = "jiter-0.8.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b25bd626bde7fb51534190c7e3cb97cee89ee76b76d7585580e22f34f5e3f393"},
977
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5c826a221851a8dc028eb6d7d6429ba03184fa3c7e83ae01cd6d3bd1d4bd17d"},
978
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d35c864c2dff13dfd79fb070fc4fc6235d7b9b359efe340e1261deb21b9fcb66"},
979
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f557c55bc2b7676e74d39d19bcb8775ca295c7a028246175d6a8b431e70835e5"},
980
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:580ccf358539153db147e40751a0b41688a5ceb275e6f3e93d91c9467f42b2e3"},
981
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:af102d3372e917cffce49b521e4c32c497515119dc7bd8a75665e90a718bbf08"},
982
+ {file = "jiter-0.8.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:cadcc978f82397d515bb2683fc0d50103acff2a180552654bb92d6045dec2c49"},
983
+ {file = "jiter-0.8.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ba5bdf56969cad2019d4e8ffd3f879b5fdc792624129741d3d83fc832fef8c7d"},
984
+ {file = "jiter-0.8.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:3b94a33a241bee9e34b8481cdcaa3d5c2116f575e0226e421bed3f7a6ea71cff"},
985
+ {file = "jiter-0.8.2-cp310-cp310-win32.whl", hash = "sha256:6e5337bf454abddd91bd048ce0dca5134056fc99ca0205258766db35d0a2ea43"},
986
+ {file = "jiter-0.8.2-cp310-cp310-win_amd64.whl", hash = "sha256:4a9220497ca0cb1fe94e3f334f65b9b5102a0b8147646118f020d8ce1de70105"},
987
+ {file = "jiter-0.8.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:2dd61c5afc88a4fda7d8b2cf03ae5947c6ac7516d32b7a15bf4b49569a5c076b"},
988
+ {file = "jiter-0.8.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a6c710d657c8d1d2adbbb5c0b0c6bfcec28fd35bd6b5f016395f9ac43e878a15"},
989
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9584de0cd306072635fe4b89742bf26feae858a0683b399ad0c2509011b9dc0"},
990
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5a90a923338531b7970abb063cfc087eebae6ef8ec8139762007188f6bc69a9f"},
991
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d21974d246ed0181558087cd9f76e84e8321091ebfb3a93d4c341479a736f099"},
992
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:32475a42b2ea7b344069dc1e81445cfc00b9d0e3ca837f0523072432332e9f74"},
993
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b9931fd36ee513c26b5bf08c940b0ac875de175341cbdd4fa3be109f0492586"},
994
+ {file = "jiter-0.8.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ce0820f4a3a59ddced7fce696d86a096d5cc48d32a4183483a17671a61edfddc"},
995
+ {file = "jiter-0.8.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:8ffc86ae5e3e6a93765d49d1ab47b6075a9c978a2b3b80f0f32628f39caa0c88"},
996
+ {file = "jiter-0.8.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5127dc1abd809431172bc3fbe8168d6b90556a30bb10acd5ded41c3cfd6f43b6"},
997
+ {file = "jiter-0.8.2-cp311-cp311-win32.whl", hash = "sha256:66227a2c7b575720c1871c8800d3a0122bb8ee94edb43a5685aa9aceb2782d44"},
998
+ {file = "jiter-0.8.2-cp311-cp311-win_amd64.whl", hash = "sha256:cde031d8413842a1e7501e9129b8e676e62a657f8ec8166e18a70d94d4682855"},
999
+ {file = "jiter-0.8.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:e6ec2be506e7d6f9527dae9ff4b7f54e68ea44a0ef6b098256ddf895218a2f8f"},
1000
+ {file = "jiter-0.8.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:76e324da7b5da060287c54f2fabd3db5f76468006c811831f051942bf68c9d44"},
1001
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:180a8aea058f7535d1c84183c0362c710f4750bef66630c05f40c93c2b152a0f"},
1002
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:025337859077b41548bdcbabe38698bcd93cfe10b06ff66617a48ff92c9aec60"},
1003
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ecff0dc14f409599bbcafa7e470c00b80f17abc14d1405d38ab02e4b42e55b57"},
1004
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ffd9fee7d0775ebaba131f7ca2e2d83839a62ad65e8e02fe2bd8fc975cedeb9e"},
1005
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14601dcac4889e0a1c75ccf6a0e4baf70dbc75041e51bcf8d0e9274519df6887"},
1006
+ {file = "jiter-0.8.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:92249669925bc1c54fcd2ec73f70f2c1d6a817928480ee1c65af5f6b81cdf12d"},
1007
+ {file = "jiter-0.8.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:e725edd0929fa79f8349ab4ec7f81c714df51dc4e991539a578e5018fa4a7152"},
1008
+ {file = "jiter-0.8.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:bf55846c7b7a680eebaf9c3c48d630e1bf51bdf76c68a5f654b8524335b0ad29"},
1009
+ {file = "jiter-0.8.2-cp312-cp312-win32.whl", hash = "sha256:7efe4853ecd3d6110301665a5178b9856be7e2a9485f49d91aa4d737ad2ae49e"},
1010
+ {file = "jiter-0.8.2-cp312-cp312-win_amd64.whl", hash = "sha256:83c0efd80b29695058d0fd2fa8a556490dbce9804eac3e281f373bbc99045f6c"},
1011
+ {file = "jiter-0.8.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:ca1f08b8e43dc3bd0594c992fb1fd2f7ce87f7bf0d44358198d6da8034afdf84"},
1012
+ {file = "jiter-0.8.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5672a86d55416ccd214c778efccf3266b84f87b89063b582167d803246354be4"},
1013
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:58dc9bc9767a1101f4e5e22db1b652161a225874d66f0e5cb8e2c7d1c438b587"},
1014
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:37b2998606d6dadbb5ccda959a33d6a5e853252d921fec1792fc902351bb4e2c"},
1015
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4ab9a87f3784eb0e098f84a32670cfe4a79cb6512fd8f42ae3d0709f06405d18"},
1016
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:79aec8172b9e3c6d05fd4b219d5de1ac616bd8da934107325a6c0d0e866a21b6"},
1017
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:711e408732d4e9a0208008e5892c2966b485c783cd2d9a681f3eb147cf36c7ef"},
1018
+ {file = "jiter-0.8.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:653cf462db4e8c41995e33d865965e79641ef45369d8a11f54cd30888b7e6ff1"},
1019
+ {file = "jiter-0.8.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:9c63eaef32b7bebac8ebebf4dabebdbc6769a09c127294db6babee38e9f405b9"},
1020
+ {file = "jiter-0.8.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:eb21aaa9a200d0a80dacc7a81038d2e476ffe473ffdd9c91eb745d623561de05"},
1021
+ {file = "jiter-0.8.2-cp313-cp313-win32.whl", hash = "sha256:789361ed945d8d42850f919342a8665d2dc79e7e44ca1c97cc786966a21f627a"},
1022
+ {file = "jiter-0.8.2-cp313-cp313-win_amd64.whl", hash = "sha256:ab7f43235d71e03b941c1630f4b6e3055d46b6cb8728a17663eaac9d8e83a865"},
1023
+ {file = "jiter-0.8.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b426f72cd77da3fec300ed3bc990895e2dd6b49e3bfe6c438592a3ba660e41ca"},
1024
+ {file = "jiter-0.8.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b2dd880785088ff2ad21ffee205e58a8c1ddabc63612444ae41e5e4b321b39c0"},
1025
+ {file = "jiter-0.8.2-cp313-cp313t-win_amd64.whl", hash = "sha256:3ac9f578c46f22405ff7f8b1f5848fb753cc4b8377fbec8470a7dc3997ca7566"},
1026
+ {file = "jiter-0.8.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:9e1fa156ee9454642adb7e7234a383884452532bc9d53d5af2d18d98ada1d79c"},
1027
+ {file = "jiter-0.8.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0cf5dfa9956d96ff2efb0f8e9c7d055904012c952539a774305aaaf3abdf3d6c"},
1028
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e52bf98c7e727dd44f7c4acb980cb988448faeafed8433c867888268899b298b"},
1029
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a2ecaa3c23e7a7cf86d00eda3390c232f4d533cd9ddea4b04f5d0644faf642c5"},
1030
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:08d4c92bf480e19fc3f2717c9ce2aa31dceaa9163839a311424b6862252c943e"},
1031
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:99d9a1eded738299ba8e106c6779ce5c3893cffa0e32e4485d680588adae6db8"},
1032
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d20be8b7f606df096e08b0b1b4a3c6f0515e8dac296881fe7461dfa0fb5ec817"},
1033
+ {file = "jiter-0.8.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d33f94615fcaf872f7fd8cd98ac3b429e435c77619777e8a449d9d27e01134d1"},
1034
+ {file = "jiter-0.8.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:317b25e98a35ffec5c67efe56a4e9970852632c810d35b34ecdd70cc0e47b3b6"},
1035
+ {file = "jiter-0.8.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fc9043259ee430ecd71d178fccabd8c332a3bf1e81e50cae43cc2b28d19e4cb7"},
1036
+ {file = "jiter-0.8.2-cp38-cp38-win32.whl", hash = "sha256:fc5adda618205bd4678b146612ce44c3cbfdee9697951f2c0ffdef1f26d72b63"},
1037
+ {file = "jiter-0.8.2-cp38-cp38-win_amd64.whl", hash = "sha256:cd646c827b4f85ef4a78e4e58f4f5854fae0caf3db91b59f0d73731448a970c6"},
1038
+ {file = "jiter-0.8.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:e41e75344acef3fc59ba4765df29f107f309ca9e8eace5baacabd9217e52a5ee"},
1039
+ {file = "jiter-0.8.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f22b16b35d5c1df9dfd58843ab2cd25e6bf15191f5a236bed177afade507bfc"},
1040
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f7200b8f7619d36aa51c803fd52020a2dfbea36ffec1b5e22cab11fd34d95a6d"},
1041
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:70bf4c43652cc294040dbb62256c83c8718370c8b93dd93d934b9a7bf6c4f53c"},
1042
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f9d471356dc16f84ed48768b8ee79f29514295c7295cb41e1133ec0b2b8d637d"},
1043
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:859e8eb3507894093d01929e12e267f83b1d5f6221099d3ec976f0c995cb6bd9"},
1044
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaa58399c01db555346647a907b4ef6d4f584b123943be6ed5588c3f2359c9f4"},
1045
+ {file = "jiter-0.8.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8f2d5ed877f089862f4c7aacf3a542627c1496f972a34d0474ce85ee7d939c27"},
1046
+ {file = "jiter-0.8.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:03c9df035d4f8d647f8c210ddc2ae0728387275340668fb30d2421e17d9a0841"},
1047
+ {file = "jiter-0.8.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8bd2a824d08d8977bb2794ea2682f898ad3d8837932e3a74937e93d62ecbb637"},
1048
+ {file = "jiter-0.8.2-cp39-cp39-win32.whl", hash = "sha256:ca29b6371ebc40e496995c94b988a101b9fbbed48a51190a4461fcb0a68b4a36"},
1049
+ {file = "jiter-0.8.2-cp39-cp39-win_amd64.whl", hash = "sha256:1c0dfbd1be3cbefc7510102370d86e35d1d53e5a93d48519688b1bf0f761160a"},
1050
+ {file = "jiter-0.8.2.tar.gz", hash = "sha256:cd73d3e740666d0e639f678adb176fad25c1bcbdae88d8d7b857e1783bb4212d"},
1051
+ ]
1052
+
1053
  [[package]]
1054
  name = "joblib"
1055
  version = "1.4.2"
 
1781
  {file = "nvidia_nvtx_cu12-12.4.127-py3-none-win_amd64.whl", hash = "sha256:641dccaaa1139f3ffb0d3164b4b84f9d253397e38246a4f2f36728b48566d485"},
1782
  ]
1783
 
1784
+ [[package]]
1785
+ name = "openai"
1786
+ version = "1.60.2"
1787
+ description = "The official Python library for the openai API"
1788
+ optional = false
1789
+ python-versions = ">=3.8"
1790
+ files = [
1791
+ {file = "openai-1.60.2-py3-none-any.whl", hash = "sha256:993bd11b96900b9098179c728026f016b4982ded7ee30dfcf4555eab1171fff9"},
1792
+ {file = "openai-1.60.2.tar.gz", hash = "sha256:a8f843e10f2855713007f491d96afb2694b11b5e02cb97c7d01a0be60bc5bb51"},
1793
+ ]
1794
+
1795
+ [package.dependencies]
1796
+ anyio = ">=3.5.0,<5"
1797
+ distro = ">=1.7.0,<2"
1798
+ httpx = ">=0.23.0,<1"
1799
+ jiter = ">=0.4.0,<1"
1800
+ pydantic = ">=1.9.0,<3"
1801
+ sniffio = "*"
1802
+ tqdm = ">4"
1803
+ typing-extensions = ">=4.11,<5"
1804
+
1805
+ [package.extras]
1806
+ datalib = ["numpy (>=1)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"]
1807
+ realtime = ["websockets (>=13,<15)"]
1808
+
1809
  [[package]]
1810
  name = "orjson"
1811
  version = "3.10.11"
 
3865
  [metadata]
3866
  lock-version = "2.0"
3867
  python-versions = "3.11.*"
3868
+ content-hash = "8320f52caedb3b1449b7c39185b00775d79131e8fff9eb652849e607edd521a6"
pyproject.toml CHANGED
@@ -29,6 +29,7 @@ aiosmtplib = "^3.0.2"
29
  langchain-huggingface = "^0.1.2"
30
  langchain-pinecone = "^0.2.0"
31
  pinecone = "^5.3.1"
 
32
 
33
 
34
  [build-system]
 
29
  langchain-huggingface = "^0.1.2"
30
  langchain-pinecone = "^0.2.0"
31
  pinecone = "^5.3.1"
32
+ openai = "^1.60.2"
33
 
34
 
35
  [build-system]
src/utils/_chat_client.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
- from groq import Groq
 
3
 
4
  import json
5
 
@@ -15,7 +16,7 @@ AVAILABLE_FUNCTIONS = {
15
 
16
  INSTRUCTIONS="""
17
  # Objective
18
- You are a Conversational AI assistant designed by Sifars, a web development company, who gives answers, in a conversational and engaging manner, to queries regarding Sifars, to the best of your ability.
19
 
20
  # Here is a bit of information about Sifars:
21
  Sifars, a pioneering web service provider, emerged onto the tech landscape in 2018 with a vision to revolutionize the digital sphere. Founded by visionary entrepreneurs Jatin Sethi, Munish Kumar, and Sukhwinder Singh, Sifars set its sights on empowering businesses worldwide with cutting-edge technology solutions. With its global headquarters nestled in the vibrant city of Patiala, Punjab, India, Sifars quickly garnered recognition as a leading application development company, committed to propelling businesses towards success in the ever-evolving tech landscape. The company leverages a diverse stack of technologies, including Python, JavaScript, React, Node.js, and more, ensuring robust and scalable solutions. Sifars also fosters a culture of innovation and work-life balance, enabling its team to thrive professionally and personally.
@@ -29,6 +30,7 @@ Alternatively tell user to drop their info and call the tool "contact us" to inf
29
  - If user wants to know more about our careers, visit [here](https://www.sifars.com/en/careers/).
30
 
31
  # RULES
 
32
  - It is mandatory for you to not ask the user's details again and again to avoid salesy and advertisement-like tone. Only ask user details when user wants to contact else answer the user's query in a conversational and engaging manner.
33
  - Avoid unnecessary tool calls.
34
  - It is mandatory that the response not contains more than 50 words.
@@ -108,13 +110,14 @@ REPORT_MISSING_CONTEXT_TOOL={
108
  class ChatClient:
109
  def __init__(
110
  self,
111
- model: str="llama-3.3-70b-versatile",
112
  max_tokens: int=4096,
113
  stream: bool=True,
114
  system_message: str=INSTRUCTIONS
115
  ):
116
- self.client = Groq(
117
- api_key=os.getenv("GROQ_API_KEY"),
 
118
  )
119
  self.model = model
120
  self.max_tokens = max_tokens
@@ -130,10 +133,10 @@ class ChatClient:
130
  async def create_chat_completions(
131
  self,
132
  messages: list,
133
- model: str="llama-3.3-70b-versatile",
134
  ):
135
  logger.info("Calling Groq API...")
136
- response = self.client.chat.completions.create(
137
  messages=[
138
  {"role": "system", "content": self.system_message},
139
  *messages
@@ -147,7 +150,7 @@ class ChatClient:
147
  )
148
  logger.info("Groq API called successfully.")
149
  tool_call_response = None
150
- for chunk in response:
151
  delta = chunk.choices[0].delta
152
  if delta and delta.content:
153
  yield delta.content
@@ -169,7 +172,7 @@ class ChatClient:
169
  )
170
  messages.append(tool_call_response)
171
  messages.extend(tool_calls_output)
172
- async for chunk in self.create_chat_completions(messages=messages, model="llama-3.3-70b-versatile"):
173
  yield chunk
174
 
175
  async def _handle_required_action(self, tool_calls: list[dict]):
 
1
  import os
2
+ # from groq import Groq
3
+ from openai import AsyncOpenAI
4
 
5
  import json
6
 
 
16
 
17
  INSTRUCTIONS="""
18
  # Objective
19
+ You are a Conversational AI assistant designed by Sifars who's response is short (note more than 50 words), to the point and engaging, a web development company, who gives answers, in a conversational and engaging manner, to queries regarding Sifars, to the best of your ability.
20
 
21
  # Here is a bit of information about Sifars:
22
  Sifars, a pioneering web service provider, emerged onto the tech landscape in 2018 with a vision to revolutionize the digital sphere. Founded by visionary entrepreneurs Jatin Sethi, Munish Kumar, and Sukhwinder Singh, Sifars set its sights on empowering businesses worldwide with cutting-edge technology solutions. With its global headquarters nestled in the vibrant city of Patiala, Punjab, India, Sifars quickly garnered recognition as a leading application development company, committed to propelling businesses towards success in the ever-evolving tech landscape. The company leverages a diverse stack of technologies, including Python, JavaScript, React, Node.js, and more, ensuring robust and scalable solutions. Sifars also fosters a culture of innovation and work-life balance, enabling its team to thrive professionally and personally.
 
30
  - If user wants to know more about our careers, visit [here](https://www.sifars.com/en/careers/).
31
 
32
  # RULES
33
+ - respond to user's questions coorectly after understanding the user's query.
34
  - It is mandatory for you to not ask the user's details again and again to avoid salesy and advertisement-like tone. Only ask user details when user wants to contact else answer the user's query in a conversational and engaging manner.
35
  - Avoid unnecessary tool calls.
36
  - It is mandatory that the response not contains more than 50 words.
 
110
  class ChatClient:
111
  def __init__(
112
  self,
113
+ model: str = os.getenv("OPENAI_MODEL"),
114
  max_tokens: int=4096,
115
  stream: bool=True,
116
  system_message: str=INSTRUCTIONS
117
  ):
118
+ self.client = AsyncOpenAI(
119
+ base_url=os.getenv("OPENAI_API_BASE_URL"),
120
+ api_key=os.getenv("OPENAI_API_KEY"),
121
  )
122
  self.model = model
123
  self.max_tokens = max_tokens
 
133
  async def create_chat_completions(
134
  self,
135
  messages: list,
136
+ model: str=os.getenv("OPENAI_MODEL"),
137
  ):
138
  logger.info("Calling Groq API...")
139
+ response = await self.client.chat.completions.create(
140
  messages=[
141
  {"role": "system", "content": self.system_message},
142
  *messages
 
150
  )
151
  logger.info("Groq API called successfully.")
152
  tool_call_response = None
153
+ async for chunk in response:
154
  delta = chunk.choices[0].delta
155
  if delta and delta.content:
156
  yield delta.content
 
172
  )
173
  messages.append(tool_call_response)
174
  messages.extend(tool_calls_output)
175
+ async for chunk in self.create_chat_completions(messages=messages):
176
  yield chunk
177
 
178
  async def _handle_required_action(self, tool_calls: list[dict]):