Update Langchains Agent, rename to Monologue (#402)

* standardize on content vs contents

* remove langchain dep

* rename langchains to monologue

* unused imports

* Update agenthub/planner_agent/prompt.py

* update locks

* fix code editor

* fix agent list in frontend
This commit is contained in:
Robert Brennan
2024-04-01 11:33:39 -04:00
committed by GitHub
parent 26c9ce132b
commit 3e6508b7f1
26 changed files with 13412 additions and 531 deletions

View File

@@ -14,9 +14,6 @@ fastapi = "*"
uvicorn = {extras = ["standard"], version = "*"}
ruff = "*"
mypy = "*"
langchain = "*"
langchain-core = "*"
langchain-community = "*"
llama-index = "*"
llama-index-vector-stores-chroma = "*"
chromadb = "*"

313
Pipfile.lock generated
View File

@@ -1,11 +1,11 @@
{
"_meta": {
"hash": {
"sha256": "b20d158bee55618d414bb9c0845d01efdcb8d3d9be4545699bc8a098d130ebe3"
"sha256": "61e9058ce6ad774de0b466d6757a01f479ce255f33a1f6e781d60befcb82e910"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.10"
"python_version": "3.11"
},
"sources": [
{
@@ -211,13 +211,6 @@
"markers": "python_full_version >= '3.6.0'",
"version": "==4.12.3"
},
"bs4": {
"hashes": [
"sha256:a48685c58f50fe127722417bae83fe6badf500d54b55f7e39ffe43b798653925",
"sha256:abf8742c0805ef7f662dce4b51cca104cffe52b835238afc169142ab9b3fbccc"
],
"version": "==0.0.2"
},
"build": {
"hashes": [
"sha256:526263f4870c26f26c433545579475377b2b7588b6f1eac76a001e873ae3e19d",
@@ -1076,21 +1069,14 @@
"markers": "python_version >= '3.7'",
"version": "==1.3.2"
},
"jsonpatch": {
"json-repair": {
"hashes": [
"sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade",
"sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c"
"sha256:1996290be1ab9757728839d05fb3dfb69490bd486c813f8c89eac1ae07d7235e",
"sha256:9bada44dcd022c66763b3470820d11ab513387951b49c8aa3c7bd51cbfd919fc"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
"version": "==1.33"
},
"jsonpointer": {
"hashes": [
"sha256:15d51bba20eea3165644553647711d150376234112651b4f1811022aecad7d7a",
"sha256:585cee82b70211fa9e6043b7bb89db6e1aa49524340dde8ad6b63206ea689d88"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
"version": "==2.4"
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==0.10.1"
},
"kiwisolver": {
"hashes": [
@@ -1210,66 +1196,23 @@
"markers": "python_version >= '3.6'",
"version": "==29.0.0"
},
"langchain": {
"hashes": [
"sha256:c87657021b777d6b07e55be379a28660a1cd148c31593569869dd6b0b4cab945",
"sha256:db330aa79c33501cb1ed97ff465f7645813eaa6cfd742c61e19c2d48e4aaba18"
],
"index": "pypi",
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.1.13"
},
"langchain-community": {
"hashes": [
"sha256:1652dddf257089b7b5066974b636262b4a5b680339f4539be133b14ae351e67d",
"sha256:d88107fafa9fe2c5733da9630c68d9ee51cd33b1c88a4950e7a2d9a38f7e7aa3"
],
"index": "pypi",
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.0.29"
},
"langchain-core": {
"hashes": [
"sha256:564beeb18ab13deca8daf6e6e74acab52e0b8f6202110262a4c914e4450febd2",
"sha256:aa2432370ca3d2a5d6dd14a810aa6488bf2f622ff7a0a3dc30f6e0ed9d7f5fa8"
],
"index": "pypi",
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.1.36"
},
"langchain-text-splitters": {
"hashes": [
"sha256:ac459fa98799f5117ad5425a9330b21961321e30bc19a2a2f9f761ddadd62aa1",
"sha256:f5b802f873f5ff6a8b9259ff34d53ed989666ef4e1582e6d1adb3b5520e3839a"
],
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.0.1"
},
"langsmith": {
"hashes": [
"sha256:2c1f98ac0a8c02e43b625650a6e13c65b09523551bfc21a59d20963f46f7d265",
"sha256:f36479f82cf537cf40d129ac2e485e72a3981360c7b6cf2549dad77d98eafd8f"
],
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.1.38"
},
"litellm": {
"hashes": [
"sha256:88e7efc8ea2edfdbd1001aa2155ab33309b1a55ee4f94b074053f91dcf57299e",
"sha256:95032c5e8a7359105906d5b39b18624dced9f723f9406dc23b907c0f9d293044"
"sha256:0fcf89f01981f934a2f1fb934ed431095893980277e499e492c15380063259bc",
"sha256:b897b97b6fa2744b5220dd23e8e3adb31d5006457e0e5ad7a5f58a4a8d5d3b82"
],
"index": "pypi",
"markers": "python_version not in '2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7' and python_version >= '3.8'",
"version": "==1.34.12"
"version": "==1.34.18"
},
"llama-index": {
"hashes": [
"sha256:1266dc66b3a9823416f8ad516af21297434fce1344f75de318ddb63aed952abd",
"sha256:a8806e4285321c4b1e0008bb626deaccfe95d7fde421103b9d4a393dd2951ce7"
"sha256:25a3f8c9f63fbdaaf3d760ce59c5dad8afc5cf40431e9e6a28e02b92a820d450",
"sha256:5a6036bcb2449277ede3244cfa1b49d9fab5dba30ad8b212c2df92449cfa7d48"
],
"index": "pypi",
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.10.25"
"version": "==0.10.26"
},
"llama-index-agent-openai": {
"hashes": [
@@ -1289,11 +1232,11 @@
},
"llama-index-core": {
"hashes": [
"sha256:32554c73cbb17d7b5c81fa469951c863939f221bcba31f606a458274b0fc11d7",
"sha256:b402ea2489175541b1c73e01ab5f33e504a70bc7acee31ba4ad2c80cf265ad88"
"sha256:8ea27093a053aed79b7b5d80694152066ddaa5b70116308d48db382c76367a87",
"sha256:e08886b9d353fb45f63d0011e78326627f1ee5c7761585fdd85a9a0dfdbf0365"
],
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.10.25.post3"
"version": "==0.10.26"
},
"llama-index-embeddings-azure-openai": {
"hashes": [
@@ -1388,11 +1331,11 @@
},
"llama-index-readers-file": {
"hashes": [
"sha256:029eecb9371c6c621cce026fa987212a55160c6cceafef5f470366ec410cc148",
"sha256:6065cbf80b0fb5d189558b8b90adbbdc92acb86147fca192d88fcc2704ad2af3"
"sha256:692988b8c3ca2807d21a171351078b634ada2ff1682ebe4a484f82da384dfc55",
"sha256:830f06ec7b34437fc3bb5f268d235c5c7640296adb148d8f92277dceb7f0846d"
],
"markers": "python_version < '4.0' and python_full_version >= '3.8.1'",
"version": "==0.1.12"
"version": "==0.1.13"
},
"llama-index-readers-llama-parse": {
"hashes": [
@@ -1427,6 +1370,14 @@
"markers": "python_version >= '3.8' and python_version < '4.0'",
"version": "==0.1.15"
},
"markdown-it-py": {
"hashes": [
"sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1",
"sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"
],
"markers": "python_version >= '3.8'",
"version": "==3.0.0"
},
"markupsafe": {
"hashes": [
"sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf",
@@ -1535,6 +1486,14 @@
"markers": "python_version >= '3.9'",
"version": "==3.8.3"
},
"mdurl": {
"hashes": [
"sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8",
"sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
],
"markers": "python_version >= '3.7'",
"version": "==0.1.2"
},
"minijinja": {
"hashes": [
"sha256:0a41541c28fd7ce64b38ddc60974930f81c163440c348393bd5143debeb309b3",
@@ -2078,11 +2037,11 @@
},
"packaging": {
"hashes": [
"sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5",
"sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"
"sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
"sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"
],
"markers": "python_version >= '3.7'",
"version": "==23.2"
"version": "==24.0"
},
"pandas": {
"hashes": [
@@ -2122,77 +2081,78 @@
},
"pillow": {
"hashes": [
"sha256:0304004f8067386b477d20a518b50f3fa658a28d44e4116970abfcd94fac34a8",
"sha256:0689b5a8c5288bc0504d9fcee48f61a6a586b9b98514d7d29b840143d6734f39",
"sha256:0eae2073305f451d8ecacb5474997c08569fb4eb4ac231ffa4ad7d342fdc25ac",
"sha256:0fb3e7fc88a14eacd303e90481ad983fd5b69c761e9e6ef94c983f91025da869",
"sha256:11fa2e5984b949b0dd6d7a94d967743d87c577ff0b83392f17cb3990d0d2fd6e",
"sha256:127cee571038f252a552760076407f9cff79761c3d436a12af6000cd182a9d04",
"sha256:154e939c5f0053a383de4fd3d3da48d9427a7e985f58af8e94d0b3c9fcfcf4f9",
"sha256:15587643b9e5eb26c48e49a7b33659790d28f190fc514a322d55da2fb5c2950e",
"sha256:170aeb00224ab3dc54230c797f8404507240dd868cf52066f66a41b33169bdbe",
"sha256:1b5e1b74d1bd1b78bc3477528919414874748dd363e6272efd5abf7654e68bef",
"sha256:1da3b2703afd040cf65ec97efea81cfba59cdbed9c11d8efc5ab09df9509fc56",
"sha256:1e23412b5c41e58cec602f1135c57dfcf15482013ce6e5f093a86db69646a5aa",
"sha256:2247178effb34a77c11c0e8ac355c7a741ceca0a732b27bf11e747bbc950722f",
"sha256:257d8788df5ca62c980314053197f4d46eefedf4e6175bc9412f14412ec4ea2f",
"sha256:3031709084b6e7852d00479fd1d310b07d0ba82765f973b543c8af5061cf990e",
"sha256:322209c642aabdd6207517e9739c704dc9f9db943015535783239022002f054a",
"sha256:322bdf3c9b556e9ffb18f93462e5f749d3444ce081290352c6070d014c93feb2",
"sha256:33870dc4653c5017bf4c8873e5488d8f8d5f8935e2f1fb9a2208c47cdd66efd2",
"sha256:35bb52c37f256f662abdfa49d2dfa6ce5d93281d323a9af377a120e89a9eafb5",
"sha256:3c31822339516fb3c82d03f30e22b1d038da87ef27b6a78c9549888f8ceda39a",
"sha256:3eedd52442c0a5ff4f887fab0c1c0bb164d8635b32c894bc1faf4c618dd89df2",
"sha256:3ff074fc97dd4e80543a3e91f69d58889baf2002b6be64347ea8cf5533188213",
"sha256:47c0995fc4e7f79b5cfcab1fc437ff2890b770440f7696a3ba065ee0fd496563",
"sha256:49d9ba1ed0ef3e061088cd1e7538a0759aab559e2e0a80a36f9fd9d8c0c21591",
"sha256:51f1a1bffc50e2e9492e87d8e09a17c5eea8409cda8d3f277eb6edc82813c17c",
"sha256:52a50aa3fb3acb9cf7213573ef55d31d6eca37f5709c69e6858fe3bc04a5c2a2",
"sha256:54f1852cd531aa981bc0965b7d609f5f6cc8ce8c41b1139f6ed6b3c54ab82bfb",
"sha256:609448742444d9290fd687940ac0b57fb35e6fd92bdb65386e08e99af60bf757",
"sha256:69ffdd6120a4737710a9eee73e1d2e37db89b620f702754b8f6e62594471dee0",
"sha256:6fad5ff2f13d69b7e74ce5b4ecd12cc0ec530fcee76356cac6742785ff71c452",
"sha256:7049e301399273a0136ff39b84c3678e314f2158f50f517bc50285fb5ec847ad",
"sha256:70c61d4c475835a19b3a5aa42492409878bbca7438554a1f89d20d58a7c75c01",
"sha256:716d30ed977be8b37d3ef185fecb9e5a1d62d110dfbdcd1e2a122ab46fddb03f",
"sha256:753cd8f2086b2b80180d9b3010dd4ed147efc167c90d3bf593fe2af21265e5a5",
"sha256:773efe0603db30c281521a7c0214cad7836c03b8ccff897beae9b47c0b657d61",
"sha256:7823bdd049099efa16e4246bdf15e5a13dbb18a51b68fa06d6c1d4d8b99a796e",
"sha256:7c8f97e8e7a9009bcacbe3766a36175056c12f9a44e6e6f2d5caad06dcfbf03b",
"sha256:823ef7a27cf86df6597fa0671066c1b596f69eba53efa3d1e1cb8b30f3533068",
"sha256:8373c6c251f7ef8bda6675dd6d2b3a0fcc31edf1201266b5cf608b62a37407f9",
"sha256:83b2021f2ade7d1ed556bc50a399127d7fb245e725aa0113ebd05cfe88aaf588",
"sha256:870ea1ada0899fd0b79643990809323b389d4d1d46c192f97342eeb6ee0b8483",
"sha256:8d12251f02d69d8310b046e82572ed486685c38f02176bd08baf216746eb947f",
"sha256:9c23f307202661071d94b5e384e1e1dc7dfb972a28a2310e4ee16103e66ddb67",
"sha256:9d189550615b4948f45252d7f005e53c2040cea1af5b60d6f79491a6e147eef7",
"sha256:a086c2af425c5f62a65e12fbf385f7c9fcb8f107d0849dba5839461a129cf311",
"sha256:a2b56ba36e05f973d450582fb015594aaa78834fefe8dfb8fcd79b93e64ba4c6",
"sha256:aebb6044806f2e16ecc07b2a2637ee1ef67a11840a66752751714a0d924adf72",
"sha256:b1b3020d90c2d8e1dae29cf3ce54f8094f7938460fb5ce8bc5c01450b01fbaf6",
"sha256:b4b6b1e20608493548b1f32bce8cca185bf0480983890403d3b8753e44077129",
"sha256:b6f491cdf80ae540738859d9766783e3b3c8e5bd37f5dfa0b76abdecc5081f13",
"sha256:b792a349405fbc0163190fde0dc7b3fef3c9268292586cf5645598b48e63dc67",
"sha256:b7c2286c23cd350b80d2fc9d424fc797575fb16f854b831d16fd47ceec078f2c",
"sha256:babf5acfede515f176833ed6028754cbcd0d206f7f614ea3447d67c33be12516",
"sha256:c365fd1703040de1ec284b176d6af5abe21b427cb3a5ff68e0759e1e313a5e7e",
"sha256:c4225f5220f46b2fde568c74fca27ae9771536c2e29d7c04f4fb62c83275ac4e",
"sha256:c570f24be1e468e3f0ce7ef56a89a60f0e05b30a3669a459e419c6eac2c35364",
"sha256:c6dafac9e0f2b3c78df97e79af707cdc5ef8e88208d686a4847bab8266870023",
"sha256:c8de2789052ed501dd829e9cae8d3dcce7acb4777ea4a479c14521c942d395b1",
"sha256:cb28c753fd5eb3dd859b4ee95de66cc62af91bcff5db5f2571d32a520baf1f04",
"sha256:cb4c38abeef13c61d6916f264d4845fab99d7b711be96c326b84df9e3e0ff62d",
"sha256:d1b35bcd6c5543b9cb547dee3150c93008f8dd0f1fef78fc0cd2b141c5baf58a",
"sha256:d8e6aeb9201e655354b3ad049cb77d19813ad4ece0df1249d3c793de3774f8c7",
"sha256:d8ecd059fdaf60c1963c58ceb8997b32e9dc1b911f5da5307aab614f1ce5c2fb",
"sha256:da2b52b37dad6d9ec64e653637a096905b258d2fc2b984c41ae7d08b938a67e4",
"sha256:e87f0b2c78157e12d7686b27d63c070fd65d994e8ddae6f328e0dcf4a0cd007e",
"sha256:edca80cbfb2b68d7b56930b84a0e45ae1694aeba0541f798e908a49d66b837f1",
"sha256:f379abd2f1e3dddb2b61bc67977a6b5a0a3f7485538bcc6f39ec76163891ee48",
"sha256:fe4c15f6c9285dc54ce6553a3ce908ed37c8f3825b5a51a15c91442bb955b868"
"sha256:048ad577748b9fa4a99a0548c64f2cb8d672d5bf2e643a739ac8faff1164238c",
"sha256:048eeade4c33fdf7e08da40ef402e748df113fd0b4584e32c4af74fe78baaeb2",
"sha256:0ba26351b137ca4e0db0342d5d00d2e355eb29372c05afd544ebf47c0956ffeb",
"sha256:0ea2a783a2bdf2a561808fe4a7a12e9aa3799b701ba305de596bc48b8bdfce9d",
"sha256:1530e8f3a4b965eb6a7785cf17a426c779333eb62c9a7d1bbcf3ffd5bf77a4aa",
"sha256:16563993329b79513f59142a6b02055e10514c1a8e86dca8b48a893e33cf91e3",
"sha256:19aeb96d43902f0a783946a0a87dbdad5c84c936025b8419da0a0cd7724356b1",
"sha256:1a1d1915db1a4fdb2754b9de292642a39a7fb28f1736699527bb649484fb966a",
"sha256:1b87bd9d81d179bd8ab871603bd80d8645729939f90b71e62914e816a76fc6bd",
"sha256:1dfc94946bc60ea375cc39cff0b8da6c7e5f8fcdc1d946beb8da5c216156ddd8",
"sha256:2034f6759a722da3a3dbd91a81148cf884e91d1b747992ca288ab88c1de15999",
"sha256:261ddb7ca91fcf71757979534fb4c128448b5b4c55cb6152d280312062f69599",
"sha256:2ed854e716a89b1afcedea551cd85f2eb2a807613752ab997b9974aaa0d56936",
"sha256:3102045a10945173d38336f6e71a8dc71bcaeed55c3123ad4af82c52807b9375",
"sha256:339894035d0ede518b16073bdc2feef4c991ee991a29774b33e515f1d308e08d",
"sha256:412444afb8c4c7a6cc11a47dade32982439925537e483be7c0ae0cf96c4f6a0b",
"sha256:4203efca580f0dd6f882ca211f923168548f7ba334c189e9eab1178ab840bf60",
"sha256:45ebc7b45406febf07fef35d856f0293a92e7417ae7933207e90bf9090b70572",
"sha256:4b5ec25d8b17217d635f8935dbc1b9aa5907962fae29dff220f2659487891cd3",
"sha256:4c8e73e99da7db1b4cad7f8d682cf6abad7844da39834c288fbfa394a47bbced",
"sha256:4e6f7d1c414191c1199f8996d3f2282b9ebea0945693fb67392c75a3a320941f",
"sha256:4eaa22f0d22b1a7e93ff0a596d57fdede2e550aecffb5a1ef1106aaece48e96b",
"sha256:50b8eae8f7334ec826d6eeffaeeb00e36b5e24aa0b9df322c247539714c6df19",
"sha256:50fd3f6b26e3441ae07b7c979309638b72abc1a25da31a81a7fbd9495713ef4f",
"sha256:51243f1ed5161b9945011a7360e997729776f6e5d7005ba0c6879267d4c5139d",
"sha256:5d512aafa1d32efa014fa041d38868fda85028e3f930a96f85d49c7d8ddc0383",
"sha256:5f77cf66e96ae734717d341c145c5949c63180842a545c47a0ce7ae52ca83795",
"sha256:6b02471b72526ab8a18c39cb7967b72d194ec53c1fd0a70b050565a0f366d355",
"sha256:6fb1b30043271ec92dc65f6d9f0b7a830c210b8a96423074b15c7bc999975f57",
"sha256:7161ec49ef0800947dc5570f86568a7bb36fa97dd09e9827dc02b718c5643f09",
"sha256:72d622d262e463dfb7595202d229f5f3ab4b852289a1cd09650362db23b9eb0b",
"sha256:74d28c17412d9caa1066f7a31df8403ec23d5268ba46cd0ad2c50fb82ae40462",
"sha256:78618cdbccaa74d3f88d0ad6cb8ac3007f1a6fa5c6f19af64b55ca170bfa1edf",
"sha256:793b4e24db2e8742ca6423d3fde8396db336698c55cd34b660663ee9e45ed37f",
"sha256:798232c92e7665fe82ac085f9d8e8ca98826f8e27859d9a96b41d519ecd2e49a",
"sha256:81d09caa7b27ef4e61cb7d8fbf1714f5aec1c6b6c5270ee53504981e6e9121ad",
"sha256:8ab74c06ffdab957d7670c2a5a6e1a70181cd10b727cd788c4dd9005b6a8acd9",
"sha256:8eb0908e954d093b02a543dc963984d6e99ad2b5e36503d8a0aaf040505f747d",
"sha256:90b9e29824800e90c84e4022dd5cc16eb2d9605ee13f05d47641eb183cd73d45",
"sha256:9797a6c8fe16f25749b371c02e2ade0efb51155e767a971c61734b1bf6293994",
"sha256:9d2455fbf44c914840c793e89aa82d0e1763a14253a000743719ae5946814b2d",
"sha256:9d3bea1c75f8c53ee4d505c3e67d8c158ad4df0d83170605b50b64025917f338",
"sha256:9e2ec1e921fd07c7cda7962bad283acc2f2a9ccc1b971ee4b216b75fad6f0463",
"sha256:9e91179a242bbc99be65e139e30690e081fe6cb91a8e77faf4c409653de39451",
"sha256:a0eaa93d054751ee9964afa21c06247779b90440ca41d184aeb5d410f20ff591",
"sha256:a2c405445c79c3f5a124573a051062300936b0281fee57637e706453e452746c",
"sha256:aa7e402ce11f0885305bfb6afb3434b3cd8f53b563ac065452d9d5654c7b86fd",
"sha256:aff76a55a8aa8364d25400a210a65ff59d0168e0b4285ba6bf2bd83cf675ba32",
"sha256:b09b86b27a064c9624d0a6c54da01c1beaf5b6cadfa609cf63789b1d08a797b9",
"sha256:b14f16f94cbc61215115b9b1236f9c18403c15dd3c52cf629072afa9d54c1cbf",
"sha256:b50811d664d392f02f7761621303eba9d1b056fb1868c8cdf4231279645c25f5",
"sha256:b7bc2176354defba3edc2b9a777744462da2f8e921fbaf61e52acb95bafa9828",
"sha256:c78e1b00a87ce43bb37642c0812315b411e856a905d58d597750eb79802aaaa3",
"sha256:c83341b89884e2b2e55886e8fbbf37c3fa5efd6c8907124aeb72f285ae5696e5",
"sha256:ca2870d5d10d8726a27396d3ca4cf7976cec0f3cb706debe88e3a5bd4610f7d2",
"sha256:ccce24b7ad89adb5a1e34a6ba96ac2530046763912806ad4c247356a8f33a67b",
"sha256:cd5e14fbf22a87321b24c88669aad3a51ec052eb145315b3da3b7e3cc105b9a2",
"sha256:ce49c67f4ea0609933d01c0731b34b8695a7a748d6c8d186f95e7d085d2fe475",
"sha256:d33891be6df59d93df4d846640f0e46f1a807339f09e79a8040bc887bdcd7ed3",
"sha256:d3b2348a78bc939b4fed6552abfd2e7988e0f81443ef3911a4b8498ca084f6eb",
"sha256:d886f5d353333b4771d21267c7ecc75b710f1a73d72d03ca06df49b09015a9ef",
"sha256:d93480005693d247f8346bc8ee28c72a2191bdf1f6b5db469c096c0c867ac015",
"sha256:dc1a390a82755a8c26c9964d457d4c9cbec5405896cba94cf51f36ea0d855002",
"sha256:dd78700f5788ae180b5ee8902c6aea5a5726bac7c364b202b4b3e3ba2d293170",
"sha256:e46f38133e5a060d46bd630faa4d9fa0202377495df1f068a8299fd78c84de84",
"sha256:e4b878386c4bf293578b48fc570b84ecfe477d3b77ba39a6e87150af77f40c57",
"sha256:f0d0591a0aeaefdaf9a5e545e7485f89910c977087e7de2b6c388aec32011e9f",
"sha256:fdcbb4068117dfd9ce0138d068ac512843c52295ed996ae6dd1faf537b6dbc27",
"sha256:ff61bfd9253c3915e6d41c651d5f962da23eda633cf02262990094a18a55371a"
],
"markers": "python_version >= '3.8'",
"version": "==10.2.0"
"version": "==10.3.0"
},
"portalocker": {
"hashes": [
@@ -2337,10 +2297,11 @@
},
"pycparser": {
"hashes": [
"sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9",
"sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"
"sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6",
"sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc"
],
"version": "==2.21"
"markers": "python_version >= '3.8'",
"version": "==2.22"
},
"pydantic": {
"hashes": [
@@ -2435,6 +2396,14 @@
"markers": "python_version >= '3.8'",
"version": "==2.16.3"
},
"pygments": {
"hashes": [
"sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c",
"sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"
],
"markers": "python_version >= '3.7'",
"version": "==2.17.2"
},
"pyjwt": {
"extras": [
"crypto"
@@ -2538,6 +2507,7 @@
"sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca",
"sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"
],
"markers": "python_version >= '3.8'",
"version": "==1.0.1"
},
"pytz": {
@@ -2719,6 +2689,13 @@
"markers": "python_version >= '3.4'",
"version": "==2.0.0"
},
"rich": {
"hashes": [
"sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222",
"sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"
],
"version": "==13.7.1"
},
"rsa": {
"hashes": [
"sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7",
@@ -2950,6 +2927,13 @@
"markers": "python_version >= '3.8'",
"version": "==69.2.0"
},
"shellingham": {
"hashes": [
"sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686",
"sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"
],
"version": "==1.5.4"
},
"six": {
"hashes": [
"sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
@@ -3304,11 +3288,30 @@
},
"typer": {
"hashes": [
"sha256:4ce7b2a60b8543816ca97d5ec016026cbe95d1a7a931083b988c1d3682548fe7",
"sha256:f5ae987b97ebbbd59182f8e84407bbc925bc636867fa007bce87a7a71ac81d5c"
"sha256:0441a0bb8962fb4383b8537ada9f7eb2d0deda0caa2cfe7387cc221290f617e4",
"sha256:900fe786ce2d0ea44653d3c8ee4594a22a496a3104370ded770c992c5e3c542d"
],
"markers": "python_version >= '3.7'",
"version": "==0.11.1"
"version": "==0.12.0"
},
"typer-cli": {
"hashes": [
"sha256:603ed3d5a278827bd497e4dc73a39bb714b230371c8724090b0de2abdcdd9f6e",
"sha256:7b7e2dd49f59974bb5a869747045d5444b17bffb851e006cd424f602d3578104"
],
"markers": "python_version >= '3.7'",
"version": "==0.12.0"
},
"typer-slim": {
"extras": [
"standard"
],
"hashes": [
"sha256:3e8a3f17286b173d76dca0fd4e02651c9a2ce1467b3754876b1ac4bd72572beb",
"sha256:ddd7042b29a32140528caa415750bcae54113ba0c32270ca11a6f64069ddadf9"
],
"markers": "python_version >= '3.7'",
"version": "==0.12.0"
},
"typing-extensions": {
"hashes": [

View File

@@ -2,7 +2,7 @@
In this folder, there may exist multiple implementations of `Agent` that will be used by the framework.
For example, `agenthub/langchain_agent`, `agenthub/metagpt_agent`, `agenthub/codeact_agent`, etc.
For example, `agenthub/monologue_agent`, `agenthub/metagpt_agent`, `agenthub/codeact_agent`, etc.
Contributors from different backgrounds and interests can choose to contribute to any (or all!) of these directions.
## Constructing an Agent

View File

@@ -2,8 +2,8 @@ from dotenv import load_dotenv
load_dotenv()
# Import agents after environment variables are loaded
from . import langchains_agent # noqa: E402
from . import monologue_agent # noqa: E402
from . import codeact_agent # noqa: E402
from . import planner_agent # noqa: E402
__all__ = ['langchains_agent', 'codeact_agent', 'planner_agent']
__all__ = ['monologue_agent', 'codeact_agent', 'planner_agent']

View File

@@ -1,4 +0,0 @@
from opendevin.agent import Agent
from .langchains_agent import LangchainsAgent
Agent.register("LangchainsAgent", LangchainsAgent)

View File

@@ -4,5 +4,5 @@ This is currently a standalone utility. It will need to be integrated into OpenD
## Usage
```bash
# Run this in project root
./agenthub/langchains_agent/build-and-run.sh "write a bash script that prints 'hello world'"
./agenthub/monologue_agent/build-and-run.sh "write a bash script that prints 'hello world'"
```

View File

@@ -0,0 +1,4 @@
from opendevin.agent import Agent
from .agent import MonologueAgent
Agent.register("MonologueAgent", MonologueAgent)

View File

@@ -1,11 +1,31 @@
from typing import List
from opendevin.agent import Agent
from opendevin.state import State
from opendevin.action import Action
from opendevin.llm.llm import LLM
import agenthub.langchains_agent.utils.prompts as prompts
from agenthub.langchains_agent.utils.monologue import Monologue
from agenthub.langchains_agent.utils.memory import LongTermMemory
from opendevin.action import (
Action,
NullAction,
CmdRunAction,
FileWriteAction,
FileReadAction,
AgentRecallAction,
BrowseURLAction,
AgentThinkAction,
)
from opendevin.observation import (
Observation,
NullObservation,
CmdOutputObservation,
FileReadObservation,
AgentRecallObservation,
BrowserOutputObservation,
)
import agenthub.monologue_agent.utils.prompts as prompts
from agenthub.monologue_agent.utils.monologue import Monologue
from agenthub.monologue_agent.utils.memory import LongTermMemory
MAX_MONOLOGUE_LENGTH = 20000
MAX_OUTPUT_LENGTH = 5000
@@ -56,7 +76,7 @@ INITIAL_THOUGHTS = [
]
class LangchainsAgent(Agent):
class MonologueAgent(Agent):
_initialized = False
def __init__(self, llm: LLM):
@@ -82,40 +102,47 @@ class LangchainsAgent(Agent):
self.monologue = Monologue()
self.memory = LongTermMemory()
next_is_output = False
output_type = ""
for thought in INITIAL_THOUGHTS:
thought = thought.replace("$TASK", task)
if next_is_output:
d = {"action": "output", "args": {"output": thought}}
next_is_output = False
if output_type != "":
observation: Observation = NullObservation(content="")
if output_type == "run":
observation = CmdOutputObservation(content=thought, command_id=0, command="")
elif output_type == "read":
observation = FileReadObservation(content=thought, path="")
elif output_type == "recall":
observation = AgentRecallObservation(content=thought, memories=[])
elif output_type == "browse":
observation = BrowserOutputObservation(content=thought, url="")
self._add_event(observation.to_dict())
output_type = ""
else:
action: Action = NullAction()
if thought.startswith("RUN"):
command = thought.split("RUN ")[1]
d = {"action": "run", "args": {"command": command}}
next_is_output = True
action = CmdRunAction(command)
output_type = "run"
elif thought.startswith("WRITE"):
parts = thought.split("WRITE ")[1].split(" > ")
path = parts[1]
content = parts[0]
d = {"action": "write", "args": {"file": path, "content": content}}
next_is_output = True
action = FileWriteAction(path=path, content=content)
elif thought.startswith("READ"):
path = thought.split("READ ")[1]
d = {"action": "read", "args": {"file": path}}
next_is_output = True
action = FileReadAction(path=path)
output_type = "read"
elif thought.startswith("RECALL"):
query = thought.split("RECALL ")[1]
d = {"action": "recall", "args": {"query": query}}
next_is_output = True
action = AgentRecallAction(query=query)
output_type = "recall"
elif thought.startswith("BROWSE"):
url = thought.split("BROWSE ")[1]
d = {"action": "browse", "args": {"url": url}}
next_is_output = True
action = BrowseURLAction(url=url)
output_type = "browse"
else:
d = {"action": "think", "args": {"thought": thought}}
self._add_event(d)
action = AgentThinkAction(thought=thought)
self._add_event(action.to_dict())
self._initialized = True
def step(self, state: State) -> Action:

View File

@@ -1,7 +1,7 @@
import traceback
import agenthub.langchains_agent.utils.json as json
import agenthub.langchains_agent.utils.prompts as prompts
import agenthub.monologue_agent.utils.json as json
import agenthub.monologue_agent.utils.prompts as prompts
class Monologue:
def __init__(self):

View File

@@ -1,13 +1,5 @@
from typing import List
from langchain.prompts import PromptTemplate
from opendevin import config
if config.get_or_default("DEBUG", False):
from langchain.globals import set_debug
set_debug(True)
from . import json
from opendevin.action import (
@@ -19,12 +11,15 @@ from opendevin.observation import (
)
ACTION_PROMPT = """
You're a thoughtful robot. Your main task is to {task}.
You're a thoughtful robot. Your main task is this:
%(task)s
Don't expand the scope of your task--just complete it as written.
This is your internal monologue, in JSON format:
```json
{monologue}
%(monologue)s
```
Your most recent thought is at the bottom of that monologue. Continue your train of thought.
@@ -34,11 +29,11 @@ It must be an object, and it must contain two fields:
* `args`, which is a map of key-value pairs, specifying the arguments for that action
Here are the possible actions:
* `read` - reads the contents of a file. Arguments:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the contents to a file. Arguments:
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `contents` - the contents to write to the file
* `content` - the content to write to the file
* `run` - runs a command. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
@@ -52,7 +47,7 @@ Here are the possible actions:
* `thought` - the thought to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
{background_commands}
%(background_commands)s
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
@@ -65,7 +60,7 @@ Notes:
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
{hint}
%(hint)s
"""
MONOLOGUE_SUMMARY_PROMPT = """
@@ -77,7 +72,7 @@ internal monologue. You can summarize individual thoughts, and
you can condense related thoughts together with a description
of their content.
```json
{monologue}
%(monologue)s
```
Make the summaries as pithy and informative as possible.
Be specific about what happened and what was learned. The summary
@@ -93,8 +88,9 @@ You can also use the same action and args from the source monologue.
def get_summarize_monologue_prompt(thoughts):
prompt = PromptTemplate.from_template(MONOLOGUE_SUMMARY_PROMPT)
return prompt.format(monologue=json.dumps({'old_monologue': thoughts}, indent=2))
return MONOLOGUE_SUMMARY_PROMPT % {
'monologue': json.dumps({'old_monologue': thoughts}, indent=2),
}
def get_request_action_prompt(
task: str,
@@ -121,13 +117,12 @@ def get_request_action_prompt(
bg_commands_message += "\nYou can end any process by sending a `kill` action with the numerical `id` above."
latest_thought = thoughts[-1]
prompt = PromptTemplate.from_template(ACTION_PROMPT)
return prompt.format(
task=task,
monologue=json.dumps(thoughts, indent=2),
background_commands=bg_commands_message,
hint=hint,
)
return ACTION_PROMPT % {
'task': task,
'monologue': json.dumps(thoughts, indent=2),
'background_commands': bg_commands_message,
'hint': hint,
}
def parse_action_response(response: str) -> Action:
json_start = response.find("{")

View File

@@ -97,11 +97,11 @@ It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
* `read` - reads the contents of a file. Arguments:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the contents to a file. Arguments:
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `contents` - the contents to write to the file
* `content` - the content to write to the file
* `run` - runs a command on the command line in a Linux shell. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
@@ -192,9 +192,9 @@ def parse_response(response: str) -> Action:
json_end = response.rfind("}") + 1
response = response[json_start:json_end]
action_dict = json.loads(response)
if 'content' in action_dict:
if 'contents' in action_dict:
# The LLM gets confused here. Might as well be robust
action_dict['contents'] = action_dict.pop('content')
action_dict['content'] = action_dict.pop('contents')
action = action_from_dict(action_dict)
return action

13438
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,7 @@ import {
changeDirectory as sendChangeDirectorySocketMessage,
changeModel,
fetchModels,
fetchAgents,
INITIAL_MODELS,
} from "../services/settingsService";
@@ -43,9 +44,9 @@ function SettingModal({ isOpen, onClose }: Props): JSX.Element {
cachedModels.length > 0 ? cachedModels : INITIAL_MODELS,
);
const [agent, setAgent] = useState(
localStorage.getItem("agent") || "LangchainsAgent",
localStorage.getItem("agent") || "MonologueAgent",
);
const [supportedAgents] = useState(
const [supportedAgents, setSupportedAgents] = useState(
cachedAgents.length > 0 ? cachedAgents : INITIAL_AGENTS,
);
@@ -54,6 +55,10 @@ function SettingModal({ isOpen, onClose }: Props): JSX.Element {
setSupportedModels(fetchedModels);
localStorage.setItem("supportedModels", JSON.stringify(fetchedModels));
});
fetchAgents().then((fetchedAgents) => {
setSupportedAgents(fetchedAgents);
localStorage.setItem("supportedAgents", JSON.stringify(fetchedAgents));
});
}, []);
const handleSaveCfg = () => {

View File

@@ -23,7 +23,7 @@ export const INITIAL_MODELS = [
export type Model = (typeof INITIAL_MODELS)[number];
export const INITIAL_AGENTS = ["LangchainsAgent", "CodeActAgent"];
export const INITIAL_AGENTS = ["MonologueAgent", "CodeActAgent"];
export type Agent = (typeof INITIAL_AGENTS)[number];

View File

@@ -20,7 +20,7 @@ const messageActions = {
store.dispatch(setScreenshotSrc(screenshotSrc));
},
write: (message: ActionMessage) => {
store.dispatch(setCode(message.args.contents));
store.dispatch(setCode(message.args.content));
},
think: (message: ActionMessage) => {
store.dispatch(appendAssistantMessage(message.args.thought));

View File

@@ -33,13 +33,13 @@ class FileReadAction(ExecutableAction):
@dataclass
class FileWriteAction(ExecutableAction):
path: str
contents: str
content: str
action: str = "write"
def run(self, controller) -> FileWriteObservation:
path = resolve_path(controller.workdir, self.path)
with open(path, 'w', encoding='utf-8') as file:
file.write(self.contents)
file.write(self.content)
return FileWriteObservation(content="", path=self.path)
@property

View File

@@ -4,7 +4,7 @@ import sys
from typing import Type
import agenthub # noqa F401 (we import this to get the agents registered)
from opendevin import config
from opendevin import config
from opendevin.agent import Agent
from opendevin.controller import AgentController
from opendevin.llm.llm import LLM
@@ -24,7 +24,7 @@ def parse_arguments():
parser.add_argument("-d", "--directory", required=True, type=str, help="The working directory for the agent")
parser.add_argument("-t", "--task", type=str, default="", help="The task for the agent to perform")
parser.add_argument("-f", "--file", type=str, help="Path to a file containing the task. Overrides -t if both are provided.")
parser.add_argument("-c", "--agent-cls", default="LangchainsAgent", type=str, help="The agent class to use")
parser.add_argument("-c", "--agent-cls", default="MonologueAgent", type=str, help="The agent class to use")
parser.add_argument("-m", "--model-name", default=config.get_or_default("LLM_MODEL", "gpt-4-0125-preview"), type=str, help="The (litellm) model name to use")
parser.add_argument("-i", "--max-iterations", default=100, type=int, help="The maximum number of iterations to run the agent")
return parser.parse_args()

View File

@@ -60,11 +60,11 @@ This list may grow over time.
* `agent_cls` - the class of the agent to use
* `start` - starts a new development task. Only sent by the client.
* `task` - the task to start
* `read` - reads the contents of a file.
* `read` - reads the content of a file.
* `path` - the path of the file to read
* `write` - writes the contents to a file.
* `write` - writes the content to a file.
* `path` - the path of the file to write
* `contents` - the contents to write to the file
* `content` - the content to write to the file
* `run` - runs a command.
* `command` - the command to run
* `background` - if true, run the command in the background
@@ -87,9 +87,9 @@ An observation has four parts:
There are several kinds of observations. Their extras are listed below.
This list may grow over time.
* `read` - the contents of a file
* `read` - the content of a file
* `path` - the path of the file read
* `browse` - the HTML contents of a url
* `browse` - the HTML content of a url
* `url` - the URL opened
* `run` - the output of a command
* `command` - the command run

View File

@@ -11,11 +11,11 @@ class ActionType(str, Enum):
"""
READ = "read"
"""Reads the contents of a file.
"""Reads the content of a file.
"""
WRITE = "write"
"""Writes the contents to a file.
"""Writes the content to a file.
"""
RUN = "run"

View File

@@ -3,11 +3,11 @@ from enum import Enum
class ObservationType(str, Enum):
READ = "read"
"""The contents of a file
"""The content of a file
"""
BROWSE = "browse"
"""The HTML contents of a URL
"""The HTML content of a URL
"""
RUN = "run"

View File

@@ -112,7 +112,7 @@ class Session:
directory = DEFAULT_WORKSPACE_DIR
if start_event and "directory" in start_event["args"]:
directory = start_event["args"]["directory"]
agent_cls = "LangchainsAgent"
agent_cls = "MonologueAgent"
if start_event and "agent_cls" in start_event["args"]:
agent_cls = start_event["args"]["agent_cls"]
model = LLM_MODEL