Compare commits

...

475 Commits

Author SHA1 Message Date
Deshraj Yadav 56351d1f8d Fix async client update_project method (#2155) 2025-01-19 09:05:59 +05:30
Dev Khant a9d1383909 Fix pytests (#2157) 2025-01-18 15:06:49 -08:00
Dev Khant 80c9c6a577 Doc: Update V2 Search/GetAll docs (#2158) 2025-01-18 10:43:03 +05:30
Dev Khant e4e5511642 Doc: Update API reference (#2154) 2025-01-18 01:06:22 +05:30
Dev Khant a4b085553a Code formatting (#2153) 2025-01-16 12:33:56 +05:30
Prateek Chhikara e12273c7cb changes to docs for custom categories (#2146) 2025-01-15 12:43:15 -08:00
Saket Aryan ee2b5adfc0 Fix lib/utils issue (#2151) 2025-01-15 09:49:38 -08:00
Dev Khant 205a03a5f2 Doc: Add update_project API (#2148) 2025-01-15 08:52:20 +05:30
Dev Khant 7be029a26f Doc: Custom instructions/Categories (#2147) 2025-01-15 07:51:16 +05:30
Dev-Khant 0bd177b30c version bump -> 0.1.44 2025-01-15 05:55:26 +05:30
Dev Khant 82359774b7 Custom instructions API improvements (#2140)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2025-01-15 05:54:23 +05:30
Dev Khant 3fa4b80deb Doc: Update ES and version bump (#2142) 2025-01-13 20:14:31 +05:30
Dev-Khant e96fd5d269 update makefile 2025-01-13 20:07:48 +05:30
Yunsung Lee 927644d712 Feat/mem0 support es (#2125) 2025-01-13 19:35:38 +05:30
Dev Khant 7397279872 HNSW support for pgvector (#2139) 2025-01-11 10:16:42 -08:00
Dev Khant 6851fac327 update api-reference for get_all (#2138) 2025-01-11 15:30:54 +05:30
Dev-Khant 254524a624 version bump -> 0.1.42 2025-01-11 13:42:17 +05:30
Dev Khant 7f0d766c09 Add support: Custom instruction/categories for projects (#2134) 2025-01-11 13:38:20 +05:30
spike-spiegel-21 ac8cf59473 entities added in proxy (#2135) 2025-01-11 01:47:42 +05:30
Dev Khant 9c4acdcba7 Doc: MemoryExport update (#2132) 2025-01-10 00:00:18 +05:30
Dev Khant a6b9721ede version bump -> 0.1.41 (#2131) 2025-01-09 20:50:47 +05:30
Dev Khant a8f3ec25b7 Code formatting and doc update (#2130) 2025-01-09 20:48:18 +05:30
Dev Khant 21854c6a24 Add support: MemoryExport API (#2129)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2025-01-09 20:43:01 +05:30
Dev-Khant 09bf7ad916 update doc 2025-01-09 18:05:14 +05:30
haarishmk26 0cc528f3b1 Commit tracking (#2127) 2025-01-09 17:40:11 +05:30
AkisAya cbd845fe41 fix VectorStoreBase abstract methods params (#2068)
Co-authored-by: Dev Khant <devkhant24@gmail.com>
2025-01-09 17:30:16 +05:30
gmdorfman 2e782b0963 feature/fixed-where-clause-default (#2042) 2025-01-09 17:21:27 +05:30
Hieu Lam 4c31c65649 Fix not working with Gemini models (#2021) 2025-01-09 17:19:26 +05:30
Mike c90f87e657 feat: allow boto3 to use its native credential finding functionality (#1536) 2025-01-09 16:59:55 +05:30
Dev Khant c63c0aca9d version bump -> 0.1.40 (#2122) 2025-01-06 16:18:41 +05:30
非法操作 d4dbed9dbd fix request mem0 without org_id raise error (#2121) 2025-01-06 16:16:13 +05:30
Dev-Khant e9188a51fe update README 2025-01-06 11:38:57 +05:30
Dev Khant d893033dcf version bump -> 0.1.39 (#2120) 2025-01-03 22:29:20 +05:30
Mayank 78a2ef41d7 [graph_memory]: improve delete/add graph memory (#2073) 2025-01-03 22:21:05 +05:30
Dev Khant 542153ad4f Update embedchain package and fix for mem0 package (#2117) 2024-12-29 00:00:40 +05:30
Dev Khant 49802137fa fix graph dependecies (#2116) 2024-12-28 23:47:55 +05:30
Prateek Chhikara 0091b31762 Updated docs about cases where memories will not be created (#2110) 2024-12-23 22:09:38 +05:30
Dev Khant 339a990510 Doc: Update API reference (#2108) 2024-12-23 17:02:49 +05:30
Saket Aryan 4c2a903618 (Update) Vercel AI SDK v0.0.10 (#2104) 2024-12-21 11:45:14 +05:30
Dev Khant 8851969169 Doc: show Token <api-key> in API-reference (#2101) 2024-12-20 16:09:34 +05:30
Dev Khant 3a5e5851dd Doc: modify Update memory API (#2099) 2024-12-20 11:13:54 +05:30
Dev Khant 716824860b Openai proxy: allow system prompt from user (#2097) 2024-12-19 15:00:53 +05:30
Dev Khant 64c80e3fbc Doc: Update V1 search params (#2096) 2024-12-19 13:08:55 +05:30
Dev Khant 9032e68917 Doc: Add Org/Proj Id to API reference (#2095) 2024-12-19 12:35:42 +05:30
Dev Khant e7da9eb00c Doc: update custom categories (#2094) 2024-12-18 13:03:50 +05:30
Dev Khant 6b99457381 Doc: Update Batch API-Reference (#2092) 2024-12-17 13:11:57 +05:30
Saket Aryan be4188c6b4 (docs) Updated docs as for using agent_id (#2090) 2024-12-16 16:02:29 +05:30
Dev Khant 4d08c16bd8 Update validate_api_key (#2089) 2024-12-15 11:34:12 +05:30
Saket Aryan 763f804277 (Update) Vercel AI SDK Memory Saving Algo (#2082) 2024-12-15 11:14:16 +05:30
Pranav Puranik 400b1f4eac Fixing the fact extraction prompt (#2037) 2024-12-13 06:42:25 +05:30
Dev-Khant 6bc86d7d2c Add keywords param to docs 2024-12-09 11:57:14 +05:30
Dev Khant df68a6b397 Doc: Update batch delete (#2078) 2024-12-08 13:45:40 +05:30
Dev-Khant b739cbbc2e update note in custom_categories 2024-12-06 13:47:12 +05:30
Dev Khant f645e50c5c update custom categories doc (#2074) 2024-12-06 13:03:33 +05:30
Feizhi Cai 2eff703e72 Update embedchain README.md (#2060) 2024-12-03 20:47:35 +05:30
Dev Khant dd06333732 Doc update (#2065) 2024-11-28 17:06:05 +05:30
Dev Khant 847e1cc986 Add support for batch update/delete (#2064) 2024-11-28 15:42:35 +05:30
Prateek Chhikara af29ecc93f Added langchain tools in the docs (#2063) 2024-11-27 18:10:44 -08:00
Dev Khant 52eaddbd8a add page and page_size in api-reference (#2061) 2024-11-27 16:10:31 +05:30
Dev-Khant 06d1757038 update get_all v2 2024-11-27 10:57:27 +05:30
Dev Khant 9900b4f5e4 Support categories filtering for GET_ALL API (#2058) 2024-11-27 10:48:06 +05:30
Saket Aryan 25ef5dda53 (Docs) Updated Docs to Include V2 Paginated/Non-Paginated Output (#2056) 2024-11-26 13:57:04 +05:30
Dev-Khant 2e1d257f36 version bump-> 0.1.33 2024-11-26 13:17:15 +05:30
Saket Aryan 4b34751bda (Docs) Updated docs for new paginated output format (#2055) 2024-11-26 12:53:07 +05:30
Dev Khant ba9c2e68f9 Doc: show output_format as param in API reference (#2053) 2024-11-26 00:24:41 +05:30
Dev Khant 86d3e36ace pass page and page_size in query params (#2052) 2024-11-26 00:00:49 +05:30
Dev-Khant 7284317cef revert pagination change and version bump 2024-11-22 19:48:27 +05:30
Dev-Khant 1508a5a418 version bump 2024-11-22 19:31:39 +05:30
Dev Khant 9b55b717e0 Handle pagination for GET_ALL (#2044) 2024-11-22 19:30:28 +05:30
Saket Aryan 8c087fcabc (Docs Update) update mem0ai usage examples to use ES6 imports (#2041) 2024-11-21 23:35:07 +05:30
Mayank 4b8e32830a [improvement]: Graph nodes extraction improved (#2035) 2024-11-21 12:27:39 +05:30
Prateek Chhikara 62ca0ddbe2 Version bump (#2038) 2024-11-20 10:21:30 -08:00
Mayank bcb41f85c9 [docs]: LlamaIndex ReAct agent tutorial added (#2036) 2024-11-20 23:38:51 +05:30
Mayank 751f5d5a19 [bug_improvement]: Update hash changed and Vector base class improved (#2034) 2024-11-20 23:18:34 +05:30
Mayank 5ab09ffd5a [Redis]: Vector database added. (#2032) 2024-11-20 17:12:16 +05:30
Saket Aryan 13374a12e9 (Feature) Vercel AI SDK (#2024) 2024-11-19 23:53:58 +05:30
Dev Khant a02597ed59 Update embedder docs to show openai key is used for LLM (#2033) 2024-11-18 16:25:23 +05:30
Dev-Khant 8a56f0ed4a API Reference: add categories to input params for v1 search 2024-11-15 21:23:33 +05:30
Dev Khant fd7fab4e08 Doc: add example for filtering through categories and metadata (#2031) 2024-11-15 13:45:46 +05:30
Dev-Khant e909e3e76c update announcement message on doc 2024-11-15 01:02:47 +05:30
Dev Khant 1ebe5b643d Add CrewAI Usage doc (#2029) 2024-11-15 00:59:52 +05:30
Mayank c0b9a10224 [llama_index_docs]: Added few blocks (#2023) 2024-11-14 21:08:32 +05:30
Dev Khant 802231c105 Update Org doc (#2026) 2024-11-14 01:15:01 +05:30
Saket Aryan 0d5085454b (Docs) Updated Docs to include mem0-node (#2022) 2024-11-11 10:06:57 -08:00
Mayank 6d535951df [graph_improvement]: Unique Id removed from update prompt (#2020) 2024-11-08 13:43:24 -08:00
Dev Khant eaf295756e Version bump and upgrade chromadb version (#2019) 2024-11-08 16:07:21 +05:30
Mayank 11894c64b3 [docs]: llama index docs added (#2018) 2024-11-07 01:24:09 -08:00
Xiang Wang b9e22beecb refine prompt of graph memory extract entities for search (#2013) 2024-11-07 00:23:16 -08:00
Dev-Khant 6f051036d9 fix api-reference for nodejs 2024-11-07 12:52:30 +05:30
Dev Khant 3731965537 Version bump and client fixes (#2017) 2024-11-07 11:36:56 +05:30
Dev-Khant 549e5e3ce8 doc fix 2024-11-07 10:59:53 +05:30
Dev-Khant 48bbfcbb2c version bump -> 0.1.28 2024-11-07 10:46:56 +05:30
Dev Khant 4cc91d7505 Add support for Org/Proj ID (#2014) 2024-11-07 10:46:08 +05:30
Dev Khant 77b0912808 Fixes for API reference (#2010) 2024-11-05 23:16:31 +05:30
Saket Aryan 6a00643bfa Docs: Integration/Vercel AI SDK (#2009) 2024-11-04 07:19:51 -08:00
Dev-Khant 2e74667cc6 Docs: reposition audio in data sources 2024-11-03 12:39:26 +05:30
Dev Khant d2b653ab10 Add audio as data source to Docs (#2007) 2024-11-03 12:35:17 +05:30
Dev Khant 2c94e6b817 version bump -> 0.1.27 (#2006) 2024-11-02 22:52:43 +05:30
Dev Khant a6ac4a6698 Replace UUID with indexes to reduce hallucinations (#2004) 2024-11-02 12:40:55 +05:30
Dev Khant e7cc8b9552 update ADD response (#2005) 2024-11-02 12:40:24 +05:30
Dev Khant f6290a0e48 Modify docs to update response format (#2002) 2024-11-01 13:22:20 +05:30
Xiang Wang 6668be3d5b fix typo in the prompt of get_update_memory_messages (#2000) 2024-10-31 21:04:59 -07:00
Xiang Wang cf12148bc7 remove redudant code from graph_memory.py (#1999)
Co-authored-by: Wang Xiang <wangxiang1@ztgame.com>
2024-10-31 16:00:55 -07:00
Mayank d928ea4a2b [integration]: Together embedder added (#1995) 2024-10-30 09:51:01 -07:00
Dev Khant efd45c0c4d Remove session_id deprecation warning (#1994) 2024-10-30 15:32:40 +05:30
Dev-Khant 4896d5c66f fix vectordb doc 2024-10-29 22:28:52 +05:30
Mohamad 61a24f011a Feature - Support Azure AI Search as a Vector DB (#1967)
Co-authored-by: Sidney Phoon <sidneyphoon17@gmail.com>
2024-10-29 22:12:39 +05:30
Dev Khant 8d9eb225a8 version bump -> 0.1.25 (#1992) 2024-10-29 11:37:10 +05:30
Dev Khant 605558da9d Code formatting (#1986) 2024-10-29 11:32:07 +05:30
Mayank dca74a1ec0 [docs]: Quickstart docs changed for v1.1 responses (#1990) 2024-10-28 15:22:18 -07:00
Dev Khant fb3eef6cf5 Proper error message if api key not found (#1985) 2024-10-26 00:04:40 +05:30
Dev-Khant 10d3209e5a Doc: add link for claude models 2024-10-24 22:44:16 +05:30
Dev Khant aace88d2e7 Update docs for AsyncClient (#1984) 2024-10-24 16:48:57 +05:30
Dev-Khant 228eaa16d5 fix customer-support-chatbot notebook 2024-10-24 09:48:28 +05:30
Dev-Khant f3416aa46a version bump -> 0.1.23 2024-10-24 09:35:10 +05:30
Dev Khant eb32fb912d Fix LLM config and Doc update for anthropic (#1983) 2024-10-23 12:54:04 -07:00
Dev Khant 8c4ee7569f version-bump -> 0.1.22 (#1981) 2024-10-22 12:46:28 +05:30
Dev Khant fbf1d8c372 Support async client (#1980) 2024-10-22 12:42:55 +05:30
Dev Khant c5d298eec8 Remove unnecessary tools (#1979) 2024-10-22 11:47:16 +05:30
Abhay Shukla 078aa66b90 Implemented Gemini (#1490) (#1965) 2024-10-21 16:23:26 +05:30
Dhanush d4ffed9822 Fixed typos: gitignore & config.mdx (#1974) 2024-10-21 15:03:39 +05:30
Jian Yu, Chen ff7761aaf8 Add Support for Customizing default_headers in Azure OpenAI (#1925) 2024-10-19 15:57:28 +05:30
Prateek Chhikara f058cda152 Version bump (#1973) 2024-10-18 10:33:15 -07:00
Deshraj Yadav b6f9054567 Add npmjs package badge on README (#1972) 2024-10-17 17:33:03 -07:00
Dev Khant 5667bc1eab Add V2 get_all (#1969) 2024-10-17 11:41:59 +05:30
Prateek Chhikara 4661d55913 Updated docs to add the "Direct Memory Storage" feature (#1966) 2024-10-16 09:59:13 -07:00
Dev Khant 9c52d72dc1 Add langchain doc (#1963) 2024-10-16 15:22:52 +05:30
femto 2cd9f94ea6 add response to m.add() call (#1732) 2024-10-15 15:53:18 -07:00
Dev Khant 2b262a65b2 Update graph doc for installation (#1959) 2024-10-15 08:13:41 -07:00
Farookh Zaheer Siddiqui bd5ce7c6d2 [Docs] : Fix typos in docs (#1960) 2024-10-15 17:23:53 +05:30
Vatsal Rathod 20c3aee636 Adding fetching data functionality for reference links in the web page (#1806) 2024-10-15 16:56:35 +05:30
Parshva Daftari 721d765921 [ Fix ]TypeError when using Chat completion (#1922) 2024-10-15 16:54:07 +05:30
sarkarsaurabh27 84eb666618 Adding autogen cookbook to help provide options of integration with a multi-agent framework (#1908) 2024-10-15 16:52:18 +05:30
Mayank 3f2d5bee34 [bug]: Memory.reset() deletes collection and table without re-creating it (#1952) 2024-10-15 16:46:50 +05:30
Deshraj Yadav 9341d9f597 Make graph memory related dependencies optional (#1954) 2024-10-15 11:54:07 +05:30
Dev Khant aacc7c25d3 update python code in API reference (#1957) 2024-10-14 12:50:56 +05:30
Deshraj Yadav b59fbb0bd2 Change ping endpoint for validating api key (#1956) 2024-10-12 14:54:50 -07:00
Dev Khant ae7b1a666e Reordering of code blocks for API reference page (#1953) 2024-10-11 18:41:59 +05:30
Deshraj Yadav bf57d253a5 Update README.md (#1949) 2024-10-09 12:36:19 -07:00
Parshva Daftari c689f94c52 [Add] Error handling for update method in OSS & platform code. (#1939) 2024-10-08 15:04:59 +05:30
Dev Khant ab862d0d40 Add custom_categories in get_all docs (#1943) 2024-10-05 11:12:05 +05:30
Deshraj Yadav 29178a4c72 Update mint.json (#1940) 2024-10-04 00:50:37 -07:00
Divyanshu Prasad d107b639b3 (bug-fix) : fix VertexAI missing configurations (#1926) 2024-10-03 21:34:14 +05:30
Parshva Daftari c09c4926a7 [ Refactored ] embedding models and [ Update ] documentation for Gemini model (#1931) 2024-10-03 21:30:46 +05:30
Dev Khant 395af18d88 chore: version -> 0.1.19 (#1937) 2024-10-03 11:25:48 +05:30
k10 ecefb793fc fixes - 1911 autoindex does not require params (#1921) 2024-10-02 16:51:13 -07:00
Dev Khant c6b9035956 Update langchain dependencies and version bump for embedchain (#1935) 2024-10-02 12:35:04 +05:30
Dev Khant 3513a9def6 version bump and update langchain-community (#1934) 2024-10-01 22:25:42 +05:30
Prateek Chhikara 0d45c61aa3 Graph memory bug fix (#1932) 2024-09-30 16:55:01 -07:00
Parshva Daftari f324462cc3 Update contributing.md (#1918) 2024-10-01 00:55:48 +05:30
dbcontributions 52bd8fca5c add-missing-response_format-parameter (#1927) 2024-10-01 00:40:22 +05:30
Dev Khant c45f14e77d fix limit param in graph memory (#1930) 2024-10-01 00:15:55 +05:30
Dev Khant 0dbfcbe6d9 multiline code for openai doc (#1929) 2024-09-30 23:21:32 +05:30
Dev Khant 23279d4248 Improve openai compatibility page (#1928) 2024-09-30 12:22:12 +05:30
Dev Khant 68c7355f47 Add limit in get_all and search for Graph (#1920) 2024-09-28 01:51:38 +05:30
Pranav Puranik aaf8e6e7ff Adding Gemini (#1862) 2024-09-27 22:16:40 +05:30
Dev Khant 699741c760 fix links (#1916) 2024-09-27 01:12:21 +05:30
Dev Khant 2d3dda3a4c Fix return types for client methods (#1914) 2024-09-26 22:10:51 +05:30
dbcontributions 61dd5a5ea4 Add vertexai test cases (#1907) 2024-09-26 21:33:55 +05:30
Dev Khant 41be228e5c chore: version -> 0.1.16 (#1904) 2024-09-25 20:07:20 +05:30
Parshva Daftari 0491854298 Fixing the bug when using Huggingface Models (#1877)
Co-authored-by: parshvadaftari <parshva@192.168.1.5>
2024-09-25 20:04:40 +05:30
Parshva Daftari 44ee48e924 [ Fix ] for the failing embedchain tests (#1899) 2024-09-25 20:02:53 +05:30
Mayank 5525c4e6fe [improvement]: Duplicate embedding generation removed. (#1900) 2024-09-25 09:54:30 +05:30
Dev Khant 3914f4d6ac Fix langgraph doc (#1898) 2024-09-24 11:16:33 +05:30
Mathew Shen 8511eca03b fix(llm): consume llm base url config with a better way (#1861) 2024-09-24 10:05:09 +05:30
Dev Khant 56ceecb4e3 chore: embedchain version -> 0.1.122 (#1896) 2024-09-23 15:16:51 +05:30
Dev Khant db5cb1986a Add organizations/projects support (#1857) 2024-09-20 10:51:02 +05:30
Deshraj Yadav 6102aa76bb Remove stale code and events improvements (#1883) 2024-09-18 14:14:21 -07:00
Dev Khant fc88cae628 update milvus docs (#1876) 2024-09-18 00:40:22 +05:30
Prateek Chhikara 8c3c9e1520 Docs update (#1875) 2024-09-17 10:53:14 -07:00
Deshraj Yadav 55c54beeab [Misc] Lint code and fix code smells (#1871) 2024-09-16 17:39:54 -07:00
Anusha Kondam 0a78cb9f7a added vector store test cases (#1868)
Co-authored-by: Dev Khant <devkhant24@gmail.com>
2024-09-16 23:51:29 +05:30
Dev Khant 3502344e89 Remove auto install library for chromadb (#1870) 2024-09-16 11:22:08 +05:30
Dev Khant 30edf49aaf chore: version -> 0.1.14 (#1869) 2024-09-16 11:15:22 +05:30
Dev Khant 5b9be679a8 Migrate session_id -> run_id (#1864)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2024-09-16 09:30:21 +05:30
Dev Khant 8e2f7f2bfb Shows all responses in api-reference (#1865) 2024-09-14 10:08:59 -07:00
Dev Khant dc5a26fe95 Update docs for exisiting APIs to support organization/project (#1859) 2024-09-14 10:33:38 +05:30
Dev Khant d66654bf67 Add API-Reference docs for Organization/Project (#1858) 2024-09-14 10:33:25 +05:30
Divyanshu Prasad 959f4bb059 Add Support for Vertex AI Embeddings (#1840) 2024-09-13 17:09:25 +05:30
Anusha Kondam f9634b4bf3 add test cases for embeddings (#1829) 2024-09-13 17:06:51 +05:30
FoliageOwO 47a8e677e9 Fixed environment variables priority in OpenAILLM (#1851) 2024-09-12 11:07:15 -07:00
Anusha Yella f40a2e7603 Add CONTRIBUTING.md (#1836)
Co-authored-by: Anu <buildknowledge111@gmail.com>
2024-09-11 22:41:14 +05:30
Prateek Chhikara ac7b7aa20a Added custom prompt support (#1849) 2024-09-10 16:57:32 -07:00
Pranav Puranik 5eeeb4e38c Fixing memory adding errors (#1848) 2024-09-10 14:37:44 -07:00
Deshraj Yadav db835cdcb8 Update README.md (#1847) 2024-09-10 11:27:55 -07:00
Dev Khant e3aca7026b chore: version -> 0.1.12 (#1846) 2024-09-10 22:11:28 +05:30
k10 3bd49b57cc Feature: milvus db integration (#1821) 2024-09-10 22:06:50 +05:30
Prateek Chhikara 5b9b65c395 Doc Updates (#1843) 2024-09-09 19:06:22 -07:00
Anusha Yella bbddb98aca Update docstring (#1837)
Co-authored-by: Anu <buildknowledge111@gmail.com>
2024-09-09 10:26:04 -07:00
Prateek Chhikara b081e43b8d Modified the return statement for ADD call | Added tests to main.py and graph_memory.py (#1812) 2024-09-09 10:04:11 -07:00
k10 58f29d8781 Make anonymous telemetry optional #1765 (#1774) 2024-09-09 09:59:06 -07:00
Shlok Khemani f01e8a083e improved docs (#1834) 2024-09-09 15:59:12 +05:30
Kirk Lin 7170edd13f feat: openai default model uses gpt-4o-mini (#1526) 2024-09-09 12:58:28 +05:30
Mayank bf0cf2d9c4 [minor]: mem0ai version changed for embedchain (#1826) 2024-09-09 11:33:41 +05:30
Mayank 51c4f2aae8 [improvement]: Graph memory support for non-structured models. (#1823) 2024-09-07 13:26:43 -07:00
Dev Khant a972d2fb07 Code Formatting (#1828) 2024-09-07 22:39:28 +05:30
Dev Khant 6a54d27286 fix v2 search doc (#1830) 2024-09-07 21:26:00 +05:30
Dev Khant d32ae1a0b1 Add support for anthropic (#1819) 2024-09-07 02:12:22 +05:30
Mathew Shen 965f7a3735 feat(memory): keep memory language (#1818) 2024-09-05 21:50:53 +05:30
Mathew Shen 136b5545ec fix: get config from config value first then environment variable (#1815) 2024-09-05 15:05:52 +05:30
Mathew Shen 8099d60e0e docs: fix docstring (#1816) 2024-09-05 15:00:37 +05:30
Prateek Chhikara da2fd1a51a Bug fixes and version bump (#1811) 2024-09-04 11:25:03 -07:00
Dev Khant 18d069d10c Improve api reference for v2 search api (#1808) 2024-09-04 10:21:32 -07:00
Dev Khant 851b665c11 Add contributing doc (#1794) 2024-09-04 10:18:40 -07:00
Yuhang c674625e88 Fix bug about MemoryGraph can't find (#1810) 2024-09-04 09:54:11 -07:00
Dev Khant 23e2ed2163 version bump (#1807) 2024-09-04 11:30:01 +05:30
Dev Khant 0b1ca090f5 Add loggers for debugging (#1796) 2024-09-04 11:16:18 +05:30
Prateek Chhikara bf3ad37369 Added parallelization to memory method calls to reduce latency (#1803) 2024-09-03 18:50:16 -07:00
Dev Khant f21ca9b765 Update add method and prompts (#1775) 2024-09-03 17:12:35 -07:00
Prateek Chhikara d113037a4f Bug fixes in docs (#1802) 2024-09-03 13:16:00 -07:00
Prateek Chhikara b2f683f3cc Bug fixes in docs (#1801) 2024-09-03 13:11:11 -07:00
Pranav Puranik 83eb800fb3 Adding v1.1 code snipper for personal-travel-assistant (#1785) 2024-09-03 11:53:39 -07:00
Arthur Howard af8454811c Fixed issue 1520 - the collect_metrics options for the app is now taken into account for all actions (#1680) 2024-09-03 23:45:57 +05:30
Prateek Chhikara 8dbfe28bbb Version increment (#1800) 2024-09-03 11:08:14 -07:00
Mark Bain 5d53b0c2ca Added rank_bm25 dependency (#1790) 2024-09-03 11:00:16 -07:00
Prateek Chhikara 65056311a6 Added user_id support for graph memory 2024-09-03 09:47:35 -07:00
Jaimin Godhani d03ba0fc8a feat: Automate installation of required libraries. (#1795) 2024-09-03 12:37:57 +05:30
Jaimin Godhani 9804f078d0 feat: automates package installation (#1780) 2024-09-02 20:23:47 +05:30
Dev Khant c886764b62 version bump (#1793) 2024-09-02 20:14:01 +05:30
Mathew Shen 2262fadd5b docs(readme): add pypi related badges (#1792) 2024-09-02 20:09:16 +05:30
dbcontributions 462aaebd6c added-pre-commit-configuration (#1782) 2024-09-01 02:11:07 +05:30
k10 077d0c47f9 AzureOpenAI Embedding Model and LLM Model Initialisation from Config. (#1773) 2024-09-01 02:09:00 +05:30
Anusha Kondam ad233034ef add-reset-api-for-client (#1783) 2024-09-01 02:01:55 +05:30
Prateek Chhikara 9d0932971d Graph memory docs update (#1786) 2024-08-31 03:47:23 +05:30
Prateek Chhikara 822a8acedb Improvements to Graph Memory (#1779) 2024-08-29 22:17:08 -07:00
Jaimin Godhani 28bc4fe05b Improve: consistency in the test_memory.py (#1777) 2024-08-29 11:36:01 -07:00
Mathew Shen df5b7109f5 fix(docs): memory addition return type (#1771) 2024-08-29 15:34:14 +05:30
Mathew Shen 4bbbc904b6 docs: add openai_base_url related docs (#1766) 2024-08-29 15:20:45 +05:30
Pranav Puranik fee3c27af3 Adding proxy server settings to azure openai (#1753) 2024-08-29 15:18:50 +05:30
Prateek Chhikara deeb4f2250 Modified the location of graph memory's colab link (#1769) 2024-08-28 13:37:09 -07:00
Prateek Chhikara a80796b5ff Added Google Colab link for Graph Memory (#1764) 2024-08-27 16:24:26 -07:00
Dev Khant a279ed0694 Fixes in API-reference page (#1763) 2024-08-27 23:01:33 +05:30
Dev Khant 06d6fe7d76 version bump (#1762) 2024-08-27 21:51:19 +05:30
Dev Khant 6057cf5202 API reference docs for Search V2 (#1760) 2024-08-27 09:06:46 -07:00
Tibor Sloboda a94bd11a76 Distance metric change and PGVectorScale support (#1703) 2024-08-27 16:56:01 +05:30
Pranav Puranik e8004537c1 get_all returns dictionary (#1756) 2024-08-27 16:26:54 +05:30
Dev Khant c8a47b2f98 add api-reference for custom categories (#1749) 2024-08-27 12:31:18 +05:30
Dev Khant c545dcf412 version bump (#1757) 2024-08-27 11:39:14 +05:30
ParseDark b80925e857 [openai_api_base support] - ft/Added openai OPENAI_API_BASE llm config support (#1737) 2024-08-25 16:25:14 +05:30
Prateek Chhikara 3fb4f2655b Added graph memory video in docs (#1745) 2024-08-24 16:02:46 -07:00
Prateek Chhikara 324e17b226 Added docs for custom categories (#1744) 2024-08-24 10:10:04 -07:00
Dev Khant b3d6e645b7 Add Search V2 (#1738) 2024-08-23 23:56:18 +05:30
Dev Khant cb2f86551b Add API Reference docs (#1742) 2024-08-23 16:52:54 +05:30
Prateek Chhikara 4f5a40a84f Docs fixes (#1730) 2024-08-22 11:01:26 -07:00
Prateek Chhikara ea86dc1576 Added customized memory to docs (#1729) 2024-08-21 15:14:11 -07:00
Deshraj Yadav 7de35b4a68 [Mem0] Update docs and improve readability (#1727) 2024-08-21 00:18:43 -07:00
Max von Hippel 2d66c23116 Make home and mem0 dirs configurable so that the service can work on AWS lambda. (#1726) 2024-08-20 23:52:37 -07:00
Prateek Chhikara 515fb86497 Readme Changes (#1725) 2024-08-20 22:49:44 -07:00
Prateek Chhikara 8ea12ca24b Added neo4j dependency (#1724) 2024-08-20 17:06:32 -07:00
Prateek Chhikara 448a21f617 Version Update (#1723) 2024-08-20 16:53:44 -07:00
Prateek Chhikara a7f5fb59c3 Add langchain-community as a dependency (#1722) 2024-08-20 16:50:17 -07:00
Prateek Chhikara c64e0824da [Mem0] Integrate Graph Memory (#1718)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2024-08-20 16:37:38 -07:00
anifort 9b7a882d57 langchain_community.embeddings is depricated and replacing with langc… (#1717) 2024-08-20 16:13:17 +05:30
Dev Khant e3a3a48973 version bump (#1721) 2024-08-20 14:58:09 +05:30
Dev Khant 6a9f5341b5 User ID needed for .add() and .search() (#1719) 2024-08-20 14:37:17 +05:30
Dev Khant e31ca239a0 Add autogen docs (#1720) 2024-08-20 14:36:38 +05:30
dbcontributions 0e0d0b8fc7 Improvement/add getting api key from env (#1710) 2024-08-19 22:35:28 +05:30
Dev Khant 8476ce5d8e bump version for embedchain (#1716) 2024-08-17 10:35:13 +05:30
Deshraj Yadav 047a85711e Update mint.json file (#1713) 2024-08-16 02:04:12 -07:00
Dev Khant 32ea60a5fc Add ollama example (#1711) 2024-08-16 00:46:12 +05:30
Dev Khant 1e39a22c52 Add langgraph doc (#1712) 2024-08-16 00:41:53 +05:30
Dev Khant daa65e7b02 fix litellm doc link (#1709) 2024-08-15 21:22:19 +05:30
Dev Khant eb7a7e09eb Add configs to llm docs (#1707) 2024-08-15 21:13:00 +05:30
从零开始学AI c0232a7d97 [embedchain doc] fix typo mysql.mdx (#1678) 2024-08-15 12:01:58 +05:30
Deshraj Yadav a8ba7abb7d [Mem0] Update dependencies and make the package lighter (#1708)
Co-authored-by: Dev-Khant <devkhant24@gmail.com>
2024-08-15 11:58:07 +05:30
rajib e35786e567 added dotenv in .toml, added an example to use qdrant, fixed the code in main.py (#1653) 2024-08-14 23:18:24 +05:30
Dev Khant 214a1ddca5 add notebook link in multion page (#1705) 2024-08-14 22:18:45 +05:30
Dev Khant 10cbee943c Add configs to Embedding docs (#1702) 2024-08-14 16:10:48 +05:30
Dev Khant aba5bb052d Fix chroma get_all method (#1701) 2024-08-14 15:04:56 +05:30
dbcontributions a461091ba5 adding param and return types (#1689) 2024-08-14 01:16:55 +05:30
Dev Khant 64218db7bd Add configs to VectorDB docs (#1699) 2024-08-13 11:57:04 -07:00
Dev Khant 2180b83a8b Handle telementry exception (#1698) 2024-08-13 10:42:51 -07:00
Dev Khant f19dfe70d7 Add delete users method (#1683) 2024-08-13 22:35:04 +05:30
Samuel Devdas 31ef9135e7 Update Config params when using Local Ollama models (#1690) 2024-08-13 11:58:14 +05:30
Taranjeet Singh 5cea47947c feat: add how mem0 works in the docs (#1694) 2024-08-13 11:34:22 +05:30
Taranjeet Singh 883ffd7de0 feat: add docs about how mem0 works (#1693) 2024-08-13 11:31:47 +05:30
Dev Khant e66f277324 Embedding docs fix (#1692) 2024-08-13 11:29:04 +05:30
Dev Khant 01cfad62b1 Version bump (#1687) 2024-08-13 00:20:29 +05:30
Dev Khant 6cc4a31e91 Add support for pgvector (#1675) 2024-08-13 00:15:08 +05:30
Dev Khant 629bb5bb63 embedding doc fix (#1685) 2024-08-12 16:20:06 +05:30
Dev Khant b245309242 Add embedder docs and config changes (#1684) 2024-08-12 16:09:01 +05:30
Mitul Kataria 464a188662 Add support for configurable embedding model (#1627)
Co-authored-by: Dev Khant <devkhant24@gmail.com>
2024-08-12 15:09:18 +05:30
dbcontributions 4aae2b5cca added on_disk param to qdrant configs (#1677) 2024-08-12 15:08:44 +05:30
Deshraj Yadav 442f6d72d0 [Docs] Fix numbering in docs (#1673) 2024-08-09 00:33:15 -07:00
Deshraj Yadav d1c5c70b4c [Mem0] Add support for getting all users in python client (#1672) 2024-08-09 00:27:54 -07:00
krescent e570888437 Update vectordb.mdx (#1670) 2024-08-09 02:41:19 +05:30
Dev Khant 38965ab6bf Docs for using Ollama locally (#1668) 2024-08-09 02:40:39 +05:30
Shlok Khemani 7a2fd70184 Companion Example (#1669) 2024-08-08 21:28:39 +05:30
cat 388c70789a fix serialized_existing_memories dump field bug (#1644) 2024-08-08 15:07:49 +05:30
freshield.eth d5b3eda16c fix cookbook memories key changes from text to memory (#1652) 2024-08-08 15:07:05 +05:30
krescent 8c8f4120f4 Update factory.py (#1657) 2024-08-08 15:06:15 +05:30
Taranjeet Singh e190445492 feat: Add page for FAQ (#1667) 2024-08-08 10:46:46 +05:30
Taranjeet Singh 2dcbcdf7a5 feat: Move core features at the top (#1665) 2024-08-08 08:31:28 +05:30
Taranjeet Singh 0ccb1124bd feat: Add features doc (#1664) 2024-08-08 08:10:45 +05:30
Taranjeet Singh 874c2e96ca Improve docs and readme (#1663) 2024-08-08 07:44:49 +05:30
Taranjeet Singh 4a643a8449 feat: Improve readme (#1661) 2024-08-08 02:50:15 +05:30
Taranjeet Singh 37cacb27ec feat: Fix banner image (#1660) 2024-08-08 00:58:34 +05:30
Taranjeet Singh a14a4405db feat: change banner image (#1659) 2024-08-08 00:52:18 +05:30
Taranjeet Singh 7ba46ec5ec feat: Improve readme (#1658) 2024-08-08 00:45:15 +05:30
Dev Khant 296327793c Fix lint issues (#1656) 2024-08-07 15:08:36 +05:30
Taranjeet Singh 4af6288adb feat: update readme (#1655) 2024-08-07 10:38:57 +05:30
Taranjeet Singh de7ee38e45 feat: Improve readme structure (#1654) 2024-08-07 09:38:17 +05:30
Dev Khant 9f6ec325fb version bump (#1641) 2024-08-04 21:13:38 +05:30
Dev-Khant b10ec8c34a Fix docs and config for vector store 2024-08-04 21:10:51 +05:30
dbcontributions b6cfd960d1 Fix/ollama test cases (#1639) 2024-08-04 12:56:25 +05:30
Dev Khant 5aa7bedabe Handle chromadb dep and version bump (#1638) 2024-08-04 00:07:15 +05:30
Dev Khant 04b4807145 Support for Openrouter (#1628) 2024-08-03 22:51:03 +05:30
Dev Khant 5837991e5c Fix config for vector store (#1637) 2024-08-03 21:48:27 +05:30
Mitul Kataria 81b4431c9b Support Azure OpenAI LLM (#1581) 2024-08-03 20:31:43 +05:30
Dev Khant 504a87d799 doc fix for components (#1636) 2024-08-03 18:58:34 +05:30
Dev Khant 024089d33e Add ollama embeddings (#1634) 2024-08-03 10:55:40 +05:30
Dev Khant 1c46fddce1 Fix litellm issue (#1635) 2024-08-03 09:23:14 +05:30
dbcontributions 784b607613 Added user_id while updating memory (#1613) 2024-08-02 23:58:28 +05:30
Dev Khant 44aa16a0f8 Support Ollama models (#1596) 2024-08-02 23:45:45 +05:30
Dev Khant 3eff82082e fix readme (#1633) 2024-08-02 21:23:00 +05:30
Dev Khant d2f6fce52e Version bump for Mem0 and Embedchain (#1632) 2024-08-02 08:35:13 -07:00
Dev Khant 419dc6598c Add OpenAI proxy (#1503)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2024-08-02 20:14:27 +05:30
krescent 51092b0b64 Update ollama.py (#1619) 2024-08-02 01:42:22 +05:30
Mathew Shen 918823d805 fix: method name should be same with abstrct base class (#1592) 2024-08-02 01:31:19 +05:30
Mitul Kataria e287fb9a89 Fixed import for EmbeddingBase class for ollama and huggingface embedders (#1548) 2024-08-02 01:20:16 +05:30
Pranav Puranik ab4f872502 correcting prompt for UPDATE_MEMORY_PROMPT (#1535) 2024-08-02 01:12:11 +05:30
Kirk Lin 8be831f7ed docs: fix guidelines link (#1530) 2024-08-02 01:09:17 +05:30
Dev Khant 67c775276f update doc to have openai key (#1614) 2024-08-02 01:07:51 +05:30
Xie Yanbo 12a4934112 fix typo (#1524) 2024-08-02 01:03:24 +05:30
Pranav Puranik b386e24f5d Sets up metadata db for every llm class (#1401) 2024-08-02 00:45:28 +05:30
Dev Khant 58b6887bf5 llm doc fix (#1631) 2024-08-02 00:41:21 +05:30
Mathew Shen 2269194662 docs(memory): add field doc (#1501) 2024-08-02 00:30:22 +05:30
Ikko Eltociear Ashimine 1290c1bb2e chore: update base.py (#1480) 2024-08-02 00:28:17 +05:30
Pranav Puranik c197a5fe93 AzureOpenai access from behind company proxies. (#1459) 2024-08-02 00:23:38 +05:30
andrewghlee 563a130141 Feature/bedrock embedder (#1470) 2024-08-01 23:25:28 +05:30
Dev Khant 80945df4ca Match output format with APIs (#1595) 2024-08-01 10:47:39 -07:00
Dev Khant 45ae1f0313 Add ChromaDB support (#1612) 2024-08-01 09:46:35 -07:00
Dev Khant e585d3c1cc Skip few tests in Mem0 (#1625) 2024-08-01 08:31:57 -07:00
Pranav Puranik abd4ec64eb Fixes pytests openai: args change and pathlib reference for pricing file (#1602) 2024-07-31 07:56:23 -07:00
Dev Khant 47afe52296 Add update method in client (#1615) 2024-07-31 11:43:30 +05:30
Dev Khant f2ddc573f6 Redundant code fix (#1611) 2024-07-30 22:42:32 +05:30
Dev Khant 6f42a95aab Fix docs (#1609) 2024-07-30 08:35:51 -07:00
Taranjeet Singh ac6b53ed0a feat: Update docs (#1608) 2024-07-30 10:57:30 +05:30
Taranjeet Singh c39436ae74 feat: update docs (#1607) 2024-07-30 10:28:43 +05:30
Taranjeet Singh 607c689cb0 feat: Improve readme and author details (#1606) 2024-07-30 10:05:47 +05:30
Taranjeet Singh 914feb65a0 Add: Licence (#1605) 2024-07-30 07:43:29 +05:30
Dev Khant ab3c9f889d Add output examples and multion travel agent notebook (#1594) 2024-07-26 23:35:21 +05:30
Taranjeet Singh bb2efb8b8b fix: substack link (#1589) 2024-07-26 12:53:11 +05:30
Taranjeet Singh 9148cce8fc Feat: Add mem0 newsletter link (#1588) 2024-07-26 00:19:42 -07:00
Prateek Chhikara cbb2b2991d Improved readme (#1587) 2024-07-26 00:01:04 -07:00
Dev Khant fd1d5e0e2b Update readme (#1549) 2024-07-23 10:28:25 -07:00
Deshraj Yadav 04b0297ae4 Update docs and README (#1546) 2024-07-23 01:02:55 -07:00
Deshraj Yadav ef706ad976 Update README.md (#1540) 2024-07-22 21:50:35 -07:00
Taranjeet Singh d9f09c1819 Fix: Slack and Discord links (#1537) 2024-07-23 08:56:45 +05:30
Dev Khant 0773b37197 update multion docs (#1518) 2024-07-20 14:17:38 -07:00
Dev Khant c8a5c6f0e9 Update mem0 version in embedchain (#1512) 2024-07-20 10:11:01 -07:00
Deshraj Yadav c7b9498693 [Mem0] Update platform client, improve deduction logic and update client docs (#1510) 2024-07-20 02:44:33 -07:00
Dev Khant c27ab0585c version bump (#1509) 2024-07-19 22:52:49 -07:00
Dev Khant e913c96926 Update docs for LLMs and Overview (#1504) 2024-07-19 22:33:16 -07:00
Dev Khant 0c9c5fe9c2 Poetry and LLM fixes (#1508) 2024-07-19 22:19:15 -07:00
Dev Khant 51fd7db205 Mem0 fix in embedchain (#1506) 2024-07-19 15:03:09 -07:00
Dev Khant e9136c1aa0 Fix CI tests for Mem0 (#1498) 2024-07-18 13:28:19 -07:00
Dev Khant a546a9f56a Update Mem0 LLM docs (#1497) 2024-07-18 13:06:40 -07:00
Dev Khant 40c9abe484 Support model config in LLMs (#1495) 2024-07-18 09:21:40 -07:00
Dev Khant c411dc294e Add Litellm support (#1493) 2024-07-17 23:49:48 -07:00
Deshraj Yadav fb5a3bfd95 Fix CI/CD (#1492) 2024-07-17 23:40:12 -07:00
Dev Khant 7441f1462d Change dependency to mem0ai (#1476) 2024-07-17 22:12:25 -07:00
Deshraj Yadav c9240e7ca6 User/dyadav/add platform docs (#1491) 2024-07-17 17:39:57 -07:00
Dev Khant 1e7618dfa4 Add AWS Bedrock support (#1482) 2024-07-17 14:38:10 -07:00
Deshraj Yadav 4e5d34103f [Docs] Add multion integration (#1489) 2024-07-17 10:53:21 -07:00
Dev Khant da435bc025 add delete and reset in docs (#1488) 2024-07-17 09:47:16 -07:00
Deshraj Yadav 2a43aa6902 [Docs] Add example for building Personal AI Assistant using Mem0 (#1486) 2024-07-16 15:20:03 -07:00
Dev Khant b620f8fae3 Add TogetherAI support (#1485) 2024-07-16 13:19:18 -07:00
Deshraj Yadav 03f787d5cb Update mem0 version to 0.0.4 (#1484) 2024-07-16 11:12:42 -07:00
Dev Khant 19637804b3 Add Groq Support (#1481) 2024-07-16 11:03:28 -07:00
Dev Khant 80f145fceb Add model pricing file (#1483) 2024-07-16 10:55:33 -07:00
Deshraj Yadav 34477d4936 Update README (#1478) 2024-07-15 00:16:56 -07:00
Deshraj Yadav 4ec51f2dd6 [Mem0] Fix issues and update docs (#1477) 2024-07-14 22:21:07 -07:00
Taranjeet Singh f842a92e25 Rename embedchain to mem0 and open sourcing code for long term memory (#1474)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2024-07-12 20:21:33 +05:30
Vatsal Rathod 83e8c97295 Refactoring vectordb naming convention in embedchain.config (#1469) 2024-07-08 16:01:17 -07:00
Dev Khant 1a5d0d236a Remove unwanted libraries and lighten package (#1391) 2024-07-08 16:00:16 -07:00
Dev Khant ebbf90f4aa Version bump -> 0.1.116 (#1464) 2024-07-06 21:23:10 -07:00
Stefan Bokarev 4f119692f1 [Docs]: Add Integration for 🧊 Helicone (LLM-Observability for Developers) (#1458) 2024-07-06 12:27:57 -07:00
Dev Khant bbe56107fb Integrate Mem0 (#1462)
Co-authored-by: Deshraj Yadav <deshraj@gatech.edu>
2024-07-06 12:27:01 -07:00
Parshva Daftari bd654e7aac Fixed Docs for the Token Usage (#1461)
Co-authored-by: parshvadaftari <parshva@192.168.1.2>
2024-07-05 08:54:04 -07:00
Dev Khant 33500a7ce2 Version bump (#1460) 2024-07-04 14:42:59 -07:00
Dev Khant 4880557d51 Show details for query tokens (#1392) 2024-07-04 11:40:56 -07:00
Dev Khant ea09b5f7f0 Version bump (#1457) 2024-07-02 23:07:52 -07:00
Pranav Puranik 5258fd91ea http_client and http_async_client bugfix (#1454) 2024-07-02 16:13:33 -07:00
João Moura b305d674de Updating dependencies (#1453) 2024-07-02 16:12:52 -07:00
Pranav Puranik 7c24601d0f Adding model_kwargs for huggingface embedders. (#1450) 2024-06-29 12:37:31 -07:00
Dev Khant 50c0285cb2 Fix batch_size for vectordb (#1449) 2024-06-28 11:18:22 -07:00
Dev Khant 0a78198bb5 Add batch_size in config for VectorDB (#1448) 2024-06-27 14:45:58 -07:00
Vatsal Rathod edaeb78ccf Refactor openai embedder (#1444) 2024-06-26 10:58:12 -07:00
Dev Khant f80be2d2ea Version bump -> 0.1.113 (#1447) 2024-06-24 11:00:55 -07:00
Halan Marques 8700165b42 Fixed Azure OpenAI Deprecations and Adjusted the Tests (#1437) 2024-06-24 10:55:38 -07:00
Prashant Dixit 18fb92f1f8 Updated LanceDB Doc (#1445) 2024-06-24 10:55:20 -07:00
Nikhil Sharma 14fc6bbadd change: replaced deprecated gpt-4-perview with gpt-4o (#1443) 2024-06-24 10:27:10 -07:00
Dev Khant 5070a1d83e Change HF embedding library (#1440) 2024-06-22 01:38:29 -07:00
Dev Khant 8a9088ea9d Version bump (#1438) 2024-06-21 09:11:24 -07:00
Prashant Dixit 48b24f6f12 Lancedb Integration (#1411) 2024-06-21 08:59:22 -07:00
Dev Khant f6ddd5ffc5 Add HF endpoint in embedder (#1436) 2024-06-21 08:57:21 -07:00
Dev Khant b43a116b3c Add vector dimension to Ollama embedder (#1435) 2024-06-21 08:56:46 -07:00
Dev Khant 50512a5f03 Doc fix for embedders (#1433) 2024-06-19 10:08:31 -07:00
Dev Khant e3e107b31d Raise import error if Ollama and Google not found (#1432) 2024-06-18 21:46:48 -07:00
Dev Khant 21a04541ea poetry fix (#1430) 2024-06-18 10:45:37 -07:00
Dev Khant cdd5d8ac76 Version bump (#1426) 2024-06-18 09:13:52 -07:00
Dev Khant 11094f504e Fix Ollama test (#1428) 2024-06-18 09:10:43 -07:00
mogith-pn 5acaae5f56 Clarifai : Added Clarifai as LLM and embedding model provider. (#1311)
Co-authored-by: Deshraj Yadav <deshraj@gatech.edu>
2024-06-17 08:48:18 -07:00
Pranav Puranik 4547d870af azure openai features and bugs solve - openai_version, docs (#1425) 2024-06-17 08:47:27 -07:00
Aditya Veer Parmar dc0d8e0932 Allow ollama llm to take custom callback for handling streaming (#1376) 2024-06-17 08:44:52 -07:00
patcher9 c558eae9ce [Docs]: Fix the Title and Description for OpenLIT Integration (#1424) 2024-06-14 00:09:31 -07:00
patcher9 abb9af66a6 [Docs]: Add Integration for OpenLIT (OpenTelemetry-native LLM Application O11y) (#1377) 2024-06-13 23:06:04 -07:00
Ananto Joyoadikusumo 4800e0344c Added language detection for non-english youtube videos (#1362) 2024-06-13 23:02:37 -07:00
Dev Khant 439b425c61 Version bump (#1423) 2024-06-13 22:28:35 -07:00
Dev Khant 2855f1635b Add support for loading api_key from config or env variable (#1421) 2024-06-13 11:19:54 -07:00
Dev Khant 08b67b4a78 Support for Audio Files (#1416) 2024-06-12 10:25:58 -07:00
Dev Khant 1bddd46ed2 Verion bump, chromadb_version change and doc update (#1407) 2024-06-12 08:46:00 -07:00
Pranav Puranik 6ecdadfd97 Add model_kwargs to OpenAI call (#1402) 2024-06-11 11:20:04 -07:00
Dimitra Gerontaki 4119040005 Add documentation for text_file data type (#1410) 2024-06-10 21:34:28 -07:00
Taranjeet Singh 873eef6ef8 Remove: EC deployment docs, and js links (#1409) 2024-06-11 02:34:15 +05:30
Taranjeet Singh 445fed4d3f Remove embedchain js (#1408) 2024-06-11 01:54:56 +05:30
Dev Khant 52fd3e0dd4 Update contributing doc (#1404) 2024-06-10 10:14:52 -07:00
Saurabh Misra 8fd0e1f3b0 ⚡️ Speed up read_env_file() in embedchain/utils/cli.py (#1260) 2024-06-09 09:11:15 -07:00
golemus 11fc4a8451 Update llms card to properly use local ollama (#1395) 2024-06-09 09:09:49 -07:00
shuo e22293294e Delete embedchain/embedder/.ollama.py.swp (#1398) 2024-06-09 09:02:38 -07:00
Dev Khant 73e53aaff1 Download Ollama model if not present (#1397) 2024-06-08 23:43:03 -07:00
Deshraj Yadav 6fa946557f Update package version to 0.1.108 (#1396) 2024-06-08 10:34:15 -07:00
Youbin Choi fb0852f585 [Bug Fix] Fix issue of loading other languages in csv file (#1225) 2024-06-08 10:09:29 -07:00
Dev Khant 4070fc1bf0 Fix ollama embeddings for remote machine (#1394) 2024-06-08 10:08:15 -07:00
Dev Khant 00c1fa1ec7 Fix OpenAI Assistant (#1393) 2024-06-08 10:07:52 -07:00
Dev Khant 04e77ef34e version bump (#1389) 2024-06-07 10:30:22 -07:00
Dev Khant 827d63d115 Fix skipped tests (#1385) 2024-06-07 10:26:54 -07:00
Anu e0d0f6e94c Change list[str] -> str for vectordbs (#1388) 2024-06-07 09:15:40 -07:00
Dev Khant fd07513004 Fix online feat and add docs (#1387) 2024-06-06 23:33:16 -07:00
Dev Khant b0e436d9c4 Poetry fixes (#1382) 2024-06-06 10:41:46 -07:00
Dev Khant a4bfd9cfc6 Version bump (#1386) 2024-06-06 10:40:38 -07:00
Dev Khant 8ca01918e5 Ollama embeddings tested and Docs ready (#1384) 2024-06-06 10:29:01 -07:00
Deshraj Yadav a5b2381458 Update version to 0.1.105 (#1383) 2024-06-05 10:53:34 -07:00
Anu 26c771503b Doc string fix for embedchain.py (#1381) 2024-06-05 10:44:09 -07:00
Saurabh Misra 622ed4a7c9 Speed up _auto_encoder() by 15% in embedchain/helpers/json_serializable.py (#1265) 2024-06-05 10:40:46 -07:00
Saurabh Misra 940f0128d5 Speed up docs site loader (#1266) 2024-06-05 10:39:30 -07:00
Saurabh Misra 1354747ca8 ⚡️ Speed up get_word_count() by 6% in embedchain/chunkers/base_chunker.py (#1268) 2024-06-05 10:36:00 -07:00
Deshraj Yadav 9544c69c55 [Improvements] Upgrade langchain-openai package and other improvements (#1372) 2024-05-21 23:42:50 -07:00
LeonieFreisinger 9ba445e623 Fix cohere embedder (#1353) 2024-05-21 22:55:10 -07:00
Abdur Rahman Nawaz ebc5e25f98 Add support for http clients in config (#1355) 2024-05-06 10:32:46 -07:00
Esparon1 78301ee63d Add feature to extract timestamps from youtube videos (#1345) 2024-05-06 10:31:04 -07:00
Niv Hertz 797dea1dca Support supplying custom headers to OpenAI requests (#1356) 2024-05-06 10:26:12 -07:00
Deshraj Yadav a0ff764f0a [Misc] Update package version for chroma and pypdf (#1352) 2024-05-01 22:24:49 -07:00
Colin O'Brien a795798156 Add Ollama as a supported embedding provider (#1344) 2024-05-01 22:08:47 -07:00
Jesús Ferretti 1a66f961f4 Docs: fix typo (#1350) 2024-05-01 22:06:22 -07:00
Deshraj Yadav 6fb2048af0 [Bug fix] Remove duplicate constants (#1342) 2024-04-19 09:50:37 -07:00
Deshraj Yadav ba9f186fc5 [Improvement] Make embedchain home dir configurable (#1341) 2024-04-18 11:20:01 -07:00
Dev Khant 6c32d287b5 Support for Excel files (#1319) 2024-04-15 22:03:43 -07:00
Deshraj Yadav 536f85b78a [Improvements] Improve logging and fix insertion in data_sources table (#1337) 2024-04-11 15:00:04 -07:00
neilbhutada f8619870ad Update llms.mdx (#1336) 2024-04-10 16:03:03 -07:00
Deshraj Yadav d00a2085d5 [Bug Fix] Make claude-3-opus model work (#1331) 2024-03-28 00:56:14 -07:00
Deshraj Yadav 85ec61335a Update package version to 0.1.98 (#1327) 2024-03-20 19:29:51 -07:00
Flyfoxs 9b48a12c27 [Bug fix] Avoid saving the duplicated docs (#1326) 2024-03-20 09:58:11 -07:00
Deshraj Yadav c181ccbe42 Update requirements.txt (#1325) 2024-03-19 21:27:21 -07:00
Deshraj Yadav 8520033d44 [Bug fix] Fix issues related to logging configuration (#1318) 2024-03-14 00:45:37 -07:00
Deshraj Yadav ebdce87fde [Version] Update version to 0.1.96 (#1317) 2024-03-14 00:02:51 -07:00
Abhishek Sharma f2122ed696 [Fix] Added missing provider for 'vllm' (#1316) 2024-03-14 00:01:30 -07:00
Deshraj Yadav 3616eaadb4 [Refactor] Improve logging package wide (#1315) 2024-03-13 17:13:30 -07:00
berwin joule ef69c91b60 [Bug fix]: fix Cannot add documents to chromadb with inconsistent sizes. (#1314) 2024-03-13 11:01:46 -07:00
Dev Khant 117824b32c Add folder and branch to GitHub (#1308) 2024-03-12 12:15:37 -07:00
Dev Khant f77f5b996e Support for Cohere Embeddings (#1310) 2024-03-12 12:14:45 -07:00
Deshraj Yadav a4d32aec24 [Docs] Update docs and readme (#1309) 2024-03-10 00:23:21 -08:00
Uzair Naeem 9111495fae Enhance code readability and documentation clarity (#1307) 2024-03-07 08:12:31 -08:00
Hardik Jindal ee1e3f0957 [docs] update langsmith.mdx (#1306) 2024-03-07 08:10:11 -08:00
Deshraj Yadav 4dc5c7348f [Bug fix]: Fix issue of OPENAI_API_BASE env variable being mandatory (#1305) 2024-03-05 14:07:44 -08:00
Deshraj Yadav 4428768eaa [Bug Fix]: Fix test cases and update version to 0.1.93 (#1303) 2024-03-04 18:35:01 -08:00
Joe 11f4ce8fb6 #1155: Add support for OpenAI-compatible endpoint in LLM and Embed (#1197) 2024-03-04 18:17:20 -08:00
Felipe Amaral 6078738d34 Feature: Custom Ollama endpoint base_url (#1301) 2024-03-04 18:09:45 -08:00
Deshraj Yadav faacfeb891 [Improvement] Set a default app id if not provided in the app configuration (#1300) 2024-03-02 15:10:34 -08:00
Deshraj Yadav 8d7e8b6fb9 [Docs] Update pinecone integration docs (#1296) 2024-03-01 16:49:43 -08:00
Deshraj Yadav 7e1d2ffdd7 [Bug fix] Fix search API for pinecone vector db 2024-03-01 16:44:42 -08:00
Deshraj Yadav 91044ec591 [Bug fix] Fix issue related to get_data_sources() method (#1295) 2024-03-01 11:54:36 -08:00
Deshraj Yadav c77a75dfb5 [Feature] Add support for NVIDIA AI LLMs and embedding models (#1293) 2024-02-29 23:56:25 -08:00
Deshraj Yadav 6518c0c06b [Docs] Update docs for resetting vector database (#1289) 2024-02-28 12:19:47 -08:00
999 changed files with 43783 additions and 29910 deletions
-1
View File
@@ -1 +0,0 @@
OPENAI_API_KEY="your-openai-api-key"
+11 -5
View File
@@ -2,14 +2,13 @@ name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
release:
types: [published] # This will trigger the workflow when you create a new release
types: [published]
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v2
@@ -25,16 +24,23 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
run: |
cd embedchain
poetry install
- name: Build a binary wheel and a source tarball
run: poetry build
run: |
cd embedchain
poetry build
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
packages_dir: embedchain/dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: embedchain/dist/
+61 -12
View File
@@ -4,22 +4,40 @@ on:
push:
branches: [main]
paths:
- 'embedchain/**'
- 'mem0/**'
- 'tests/**'
- 'examples/**'
- 'embedchain/**'
pull_request:
paths:
- 'embedchain/**'
- 'mem0/**'
- 'tests/**'
- 'examples/**'
- 'embedchain/**'
jobs:
build:
check_changes:
runs-on: ubuntu-latest
outputs:
mem0_changed: ${{ steps.filter.outputs.mem0 }}
embedchain_changed: ${{ steps.filter.outputs.embedchain }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
mem0:
- 'mem0/**'
- 'tests/**'
embedchain:
- 'embedchain/**'
build_mem0:
needs: check_changes
if: needs.check_changes.outputs.mem0_changed == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
@@ -37,17 +55,48 @@ jobs:
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
key: venv-mem0-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: make install_all
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Lint with ruff
run: make lint
- name: Run tests and generate coverage report
run: make coverage
run: make test
build_embedchain:
needs: check_changes
if: needs.check_changes.outputs.embedchain_changed == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-embedchain-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: cd embedchain && make install_all
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Lint with ruff
run: cd embedchain && make lint
- name: Run tests and generate coverage report
run: cd embedchain && make coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
file: coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+8 -2
View File
@@ -103,7 +103,7 @@ ipython_config.py
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# pdm stores project-wide configurations in .pdm.toml, but it is recommended not to include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
@@ -165,7 +165,7 @@ cython_debug/
# Database
db
test-db
!embedchain/core/db/
!embedchain/embedchain/core/db/
.vscode
.idea/
@@ -179,3 +179,9 @@ notebooks/*.yaml
# cache db
*.db
# local directories for testing
eval/
qdrant_storage/
.crossnote
testing.ipynb
+12 -16
View File
@@ -1,20 +1,16 @@
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.220'
hooks:
- id: ruff
name: ruff
# Respect `exclude` and `extend-exclude` settings.
args: ["--force-exclude"]
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: poetry run pytest
- id: ruff
name: Ruff
entry: ruff check
language: system
pass_filenames: false
always_run: true
types: [python]
args: [--fix]
- id: isort
name: isort
entry: isort
language: system
types: [python]
args: ["--profile", "black"]
+11 -30
View File
@@ -1,4 +1,4 @@
# Contributing to embedchain
# Contributing to mem0
Let us make contribution easy, collaborative and fun.
@@ -10,9 +10,8 @@ To make a contribution, follow these steps:
2. Do the changes on your fork with dedicated feature branch `feature/f1`
3. If you modified the code (new feature or bug-fix), please add tests for it
4. Include proper documentation / docstring and examples to run the feature
5. Check the linting
6. Ensure that all tests pass
7. Submit a pull request
5. Ensure that all tests pass
6. Submit a pull request
For more details about pull requests, please read [GitHub's guides](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
@@ -24,9 +23,7 @@ We use `poetry` as our package manager. You can install poetry by following the
Please DO NOT use pip or conda to install the dependencies. Instead, use poetry:
```bash
poetry install --all-extras
or
poetry install --with dev
make install_all
#activate
@@ -41,34 +38,18 @@ To ensure our standards, make sure to install pre-commit before starting to cont
pre-commit install
```
### 🧹 Linting
We use `ruff` to lint our code. You can run the linter by running the following command:
```bash
make lint
```
Make sure that the linter does not report any errors or warnings before submitting a pull request.
### Code Formatting with `black`
We use `black` to reformat the code by running the following command:
```bash
make format
```
### 🧪 Testing
We use `pytest` to test our code. You can run the tests by running the following command:
```bash
poetry run pytest
poetry run pytest tests
# or
make test
```
Make sure that all tests pass before submitting a pull request.
Several packages have been removed from Poetry to make the package lighter. Therefore, it is recommended to run `make install_all` to install the remaining packages and ensure all tests pass. Make sure that all tests pass before submitting a pull request.
## 🚀 Release Process
At the moment, the release process is manual. We try to make frequent releases. Usually, we release a new version when we have a new feature or bugfix. A developer with admin rights to the repository will create a new release on GitHub, and then publish the new version to PyPI.
We look forward to your pull requests and can't wait to see your contributions!
+24 -33
View File
@@ -1,42 +1,34 @@
# Variables
PYTHON := python3
PIP := $(PYTHON) -m pip
PROJECT_NAME := embedchain
.PHONY: format sort lint
# Targets
.PHONY: install format lint clean test ci_lint ci_test coverage
# Variables
ISORT_OPTIONS = --profile black
PROJECT_NAME := mem0ai
# Default target
all: format sort lint
install:
poetry install
install_all:
poetry install --all-extras
poetry run pip install pinecone-text pinecone-client
install_es:
poetry install --extras elasticsearch
install_opensearch:
poetry install --extras opensearch
install_milvus:
poetry install --extras milvus
shell:
poetry shell
py_shell:
poetry run python
poetry install
poetry run pip install groq together boto3 litellm ollama chromadb sentence_transformers vertexai \
google-generativeai elasticsearch
# Format code with ruff
format:
$(PYTHON) -m black .
$(PYTHON) -m isort .
poetry run ruff format mem0/
clean:
rm -rf dist build *.egg-info
# Sort imports with isort
sort:
poetry run isort mem0/
# Lint code with ruff
lint:
poetry run ruff .
poetry run ruff check mem0/
docs:
cd docs && mintlify dev
build:
poetry build
@@ -44,9 +36,8 @@ build:
publish:
poetry publish
# for example: make test file=tests/test_factory.py
test:
poetry run pytest $(file)
clean:
poetry run rm -rf dist
coverage:
poetry run pytest --cov=$(PROJECT_NAME) --cov-report=xml
test:
poetry run pytest tests
+183 -84
View File
@@ -1,129 +1,228 @@
<p align="center">
<img src="docs/logo/dark.svg" width="400px" alt="Embedchain Logo">
</p>
<p align="center">
<a href="https://runacap.com/ross-index/q3-2023/" target="_blank" rel="noopener"><img style="width: 260px; height: 56px" src="https://runacap.com/wp-content/uploads/2023/10/ROSS_badge_black_Q3_2023.svg" alt="ROSS Index - Fastest Growing Open-Source Startups in Q3 2023 | Runa Capital" width="260" height="56"/></a>
</p>
<p align="center">
<a href="https://pypi.org/project/embedchain/">
<img src="https://img.shields.io/pypi/v/embedchain" alt="PyPI">
<a href="https://github.com/mem0ai/mem0">
<img src="docs/images/banner-sm.png" width="800px" alt="Mem0 - The Memory Layer for Personalized AI">
</a>
<a href="https://pepy.tech/project/embedchain">
<img src="https://static.pepy.tech/badge/embedchain" alt="Downloads">
<p align="center" style="display: flex; justify-content: center; gap: 20px; align-items: center;">
<a href="https://trendshift.io/repositories/11194" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/11194" alt="mem0ai%2Fmem0 | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<a href="https://embedchain.ai/slack">
<img src="https://img.shields.io/badge/slack-embedchain-brightgreen.svg?logo=slack" alt="Slack">
</a>
<a href="https://embedchain.ai/discord">
<img src="https://dcbadge.vercel.app/api/server/6PzXDgEjG5?style=flat" alt="Discord">
</a>
<a href="https://twitter.com/embedchain">
<img src="https://img.shields.io/twitter/follow/embedchain" alt="Twitter">
</a>
<a href="https://colab.research.google.com/drive/138lMWhENGeEu7Q1-6lNbNTHGLZXBBz_B?usp=sharing">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab">
</a>
<a href="https://codecov.io/gh/embedchain/embedchain">
<img src="https://codecov.io/gh/embedchain/embedchain/graph/badge.svg?token=EMRRHZXW1Q" alt="codecov">
<a href="https://www.ycombinator.com/launches/LpA-mem0-open-source-memory-layer-for-ai-apps" target="_blank">
<img alt="Launch YC: Mem0 - Open Source Memory Layer for AI Apps" src="https://www.ycombinator.com/launches/LpA-mem0-open-source-memory-layer-for-ai-apps/upvote_embed.svg"/>
</a>
</p>
<hr />
## What is Embedchain?
<p align="center">
<a href="https://mem0.ai">Learn more</a>
·
<a href="https://mem0.dev/DiG">Join Discord</a>
</p>
</p>
Embedchain is an Open Source RAG Framework that makes it easy to create and deploy AI apps. At its core, Embedchain follows the design principle of being *"Conventional but Configurable"* to serve both software engineers and machine learning engineers.
<p align="center">
<a href="https://mem0.dev/DiG">
<img src="https://dcbadge.vercel.app/api/server/6PzXDgEjG5?style=flat" alt="Mem0 Discord">
</a>
<a href="https://pepy.tech/project/mem0ai">
<img src="https://img.shields.io/pypi/dm/mem0ai" alt="Mem0 PyPI - Downloads" >
</a>
<a href="https://github.com/mem0ai/mem0">
<img src="https://img.shields.io/github/commit-activity/m/mem0ai/mem0?style=flat-square" alt="GitHub commit activity">
</a>
<a href="https://pypi.org/project/mem0ai" target="_blank">
<img src="https://img.shields.io/pypi/v/mem0ai?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://www.npmjs.com/package/mem0ai" target="_blank">
<img src="https://img.shields.io/npm/v/mem0ai" alt="Npm package">
</a>
<a href="https://www.ycombinator.com/companies/mem0">
<img src="https://img.shields.io/badge/Y%20Combinator-S24-orange?style=flat-square" alt="Y Combinator S24">
</a>
</p>
Embedchain streamlines the creation of Retrieval-Augmented Generation (RAG) applications, offering a seamless process for managing various types of unstructured data. It efficiently segments data into manageable chunks, generates relevant embeddings, and stores them in a vector database for optimized retrieval. With a suite of diverse APIs, it enables users to extract contextual information, find precise answers, or engage in interactive chat conversations, all tailored to their own data.
## 🔧 Quick install
# Introduction
### Python API
[Mem0](https://mem0.ai) (pronounced as "mem-zero") enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. Mem0 remembers user preferences, adapts to individual needs, and continuously improves over time, making it ideal for customer support chatbots, AI assistants, and autonomous systems.
<!-- Start of Selection -->
<p style="display: flex;">
<span style="font-size: 1.2em;">New Feature: Introducing Graph Memory. Check out our <a href="https://docs.mem0.ai/open-source/graph-memory" target="_blank">documentation</a>.</span>
</p>
<!-- End of Selection -->
### Core Features
- **Multi-Level Memory**: User, Session, and AI Agent memory retention
- **Adaptive Personalization**: Continuous improvement based on interactions
- **Developer-Friendly API**: Simple integration into various applications
- **Cross-Platform Consistency**: Uniform behavior across devices
- **Managed Service**: Hassle-free hosted solution
### How Mem0 works?
Mem0 leverages a hybrid database approach to manage and retrieve long-term memories for AI agents and assistants. Each memory is associated with a unique identifier, such as a user ID or agent ID, allowing Mem0 to organize and access memories specific to an individual or context.
When a message is added to the Mem0 using add() method, the system extracts relevant facts and preferences and stores it across data stores: a vector database, a key-value database, and a graph database. This hybrid approach ensures that different types of information are stored in the most efficient manner, making subsequent searches quick and effective.
When an AI agent or LLM needs to recall memories, it uses the search() method. Mem0 then performs search across these data stores, retrieving relevant information from each source. This information is then passed through a scoring layer, which evaluates their importance based on relevance, importance, and recency. This ensures that only the most personalized and useful context is surfaced.
The retrieved memories can then be appended to the LLM's prompt as needed, enhancing the personalization and relevance of its responses.
### Use Cases
Mem0 empowers organizations and individuals to enhance:
- **AI Assistants and agents**: Seamless conversations with a touch of déjà vu
- **Personalized Learning**: Tailored content recommendations and progress tracking
- **Customer Support**: Context-aware assistance with user preference memory
- **Healthcare**: Patient history and treatment plan management
- **Virtual Companions**: Deeper user relationships through conversation memory
- **Productivity**: Streamlined workflows based on user habits and task history
- **Gaming**: Adaptive environments reflecting player choices and progress
## Get Started
The easiest way to set up Mem0 is through the managed [Mem0 Platform](https://app.mem0.ai). This hosted solution offers automatic updates, advanced analytics, and dedicated support. [Sign up](https://app.mem0.ai) to get started.
If you prefer to self-host, use the open-source Mem0 package. Follow the [installation instructions](#install) to get started.
## Installation Instructions <a name="install"></a>
Install the Mem0 package via pip:
```bash
pip install embedchain
pip install mem0ai
```
## ✨ Live demo
Alternatively, you can use Mem0 with one click on the hosted platform [here](https://app.mem0.ai/).
Checkout the [Chat with PDF](https://embedchain.ai/demo/chat-pdf) live demo we created using Embedchain. You can find the source code [here](https://github.com/embedchain/embedchain/tree/main/examples/chat-pdf).
### Basic Usage
## 🔍 Usage
Mem0 requires an LLM to function, with `gpt-4o` from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our [Supported LLMs documentation](https://docs.mem0.ai/llms).
<!-- Demo GIF or Image -->
<p align="center">
<img src="docs/images/cover.gif" width="900px" alt="Embedchain Demo">
</p>
First step is to instantiate the memory:
For example, you can create an Elon Musk bot using the following code:
```python
from mem0 import Memory
m = Memory()
```
<details>
<summary>How to set OPENAI_API_KEY</summary>
```python
import os
from embedchain import App
os.environ["OPENAI_API_KEY"] = "sk-xxx"
```
</details>
# Create a bot instance
os.environ["OPENAI_API_KEY"] = "YOUR API KEY"
elon_bot = App()
# Embed online resources
elon_bot.add("https://en.wikipedia.org/wiki/Elon_Musk")
elon_bot.add("https://www.forbes.com/profile/elon-musk")
You can perform the following task on the memory:
# Query the bot
elon_bot.query("How many companies does Elon Musk run and name those?")
# Answer: Elon Musk currently runs several companies. As of my knowledge, he is the CEO and lead designer of SpaceX, the CEO and product architect of Tesla, Inc., the CEO and founder of Neuralink, and the CEO and founder of The Boring Company. However, please note that this information may change over time, so it's always good to verify the latest updates.
1. Add: Store a memory from any unstructured text
2. Update: Update memory of a given memory_id
3. Search: Fetch memories based on a query
4. Get: Return memories for a certain user/agent/session
5. History: Describe how a memory has changed over time for a specific memory ID
```python
# 1. Add: Store a memory from any unstructured text
result = m.add("I am working on improving my tennis skills. Suggest some online courses.", user_id="alice", metadata={"category": "hobbies"})
# Created memory --> 'Improving her tennis skills.' and 'Looking for online suggestions.'
```
You can also try it in your browser with Google Colab:
```python
# 2. Update: update the memory
result = m.update(memory_id=<memory_id_1>, data="Likes to play tennis on weekends")
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/17ON1LPonnXAtLaZEebnOktstB_1cJJmh?usp=sharing)
# Updated memory --> 'Likes to play tennis on weekends.' and 'Looking for online suggestions.'
```
## 📖 Documentation
Comprehensive guides and API documentation are available to help you get the most out of Embedchain:
```python
# 3. Search: search related memories
related_memories = m.search(query="What are Alice's hobbies?", user_id="alice")
- [Introduction](https://docs.embedchain.ai/get-started/introduction#what-is-embedchain)
- [Getting Started](https://docs.embedchain.ai/get-started/quickstart)
- [Examples](https://docs.embedchain.ai/examples)
- [Supported data types](https://docs.embedchain.ai/components/data-sources/overview)
# Retrieved memory --> 'Likes to play tennis on weekends'
```
## 🔗 Join the Community
```python
# 4. Get all memories
all_memories = m.get_all()
memory_id = all_memories["memories"][0] ["id"] # get a memory_id
* Connect with fellow developers by joining our [Slack Community](https://embedchain.ai/slack) or [Discord Community](https://embedchain.ai/discord).
# All memory items --> 'Likes to play tennis on weekends.' and 'Looking for online suggestions.'
```
* Dive into [GitHub Discussions](https://github.com/embedchain/embedchain/discussions), ask questions, or share your experiences.
```python
# 5. Get memory history for a particular memory_id
history = m.history(memory_id=<memory_id_1>)
## 🤝 Schedule a 1-on-1 Session
# Logs corresponding to memory_id_1 --> {'prev_value': 'Working on improving tennis skills and interested in online courses for tennis.', 'new_value': 'Likes to play tennis on weekends' }
```
Book a [1-on-1 Session](https://cal.com/taranjeetio/ec) with the founders, to discuss any issues, provide feedback, or explore how we can improve Embedchain for you.
> [!TIP]
> If you prefer a hosted version without the need to set up infrastructure yourself, check out the [Mem0 Platform](https://app.mem0.ai/) to get started in minutes.
## 🌐 Contributing
Contributions are welcome! Please check out the issues on the repository, and feel free to open a pull request.
For more information, please see the [contributing guidelines](CONTRIBUTING.md).
### Graph Memory
To initialize Graph Memory you'll need to set up your configuration with graph store providers.
Currently, we support Neo4j as a graph store provider. You can setup [Neo4j](https://neo4j.com/) locally or use the hosted [Neo4j AuraDB](https://neo4j.com/product/auradb/).
Moreover, you also need to set the version to `v1.1` (*prior versions are not supported*).
Here's how you can do it:
For more reference, please go through [Development Guide](https://docs.embedchain.ai/contribution/dev) and [Documentation Guide](https://docs.embedchain.ai/contribution/docs).
```python
from mem0 import Memory
<a href="https://github.com/embedchain/embedchain/graphs/contributors">
<img src="https://contrib.rocks/image?repo=embedchain/embedchain" />
config = {
"graph_store": {
"provider": "neo4j",
"config": {
"url": "neo4j+s://xxx",
"username": "neo4j",
"password": "xxx"
}
},
"version": "v1.1"
}
m = Memory.from_config(config_dict=config)
```
## Documentation
For detailed usage instructions and API reference, visit our documentation at [docs.mem0.ai](https://docs.mem0.ai). Here, you can find more information on both the open-source version and the hosted [Mem0 Platform](https://app.mem0.ai).
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=mem0ai/mem0&type=Date)](https://star-history.com/#mem0ai/mem0&Date)
## Support
Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:
- [Join our Discord](https://mem0.dev/DiG)
- [Follow us on Twitter](https://x.com/mem0ai)
- [Email founders](mailto:founders@mem0.ai)
## Contributors
Join our [Discord community](https://mem0.dev/DiG) to learn about memory management for AI agents and LLMs, and connect with Mem0 users and contributors. Share your ideas, questions, or feedback in our [GitHub Issues](https://github.com/mem0ai/mem0/issues).
We value and appreciate the contributions of our community. Special thanks to our contributors for helping us improve Mem0.
<a href="https://github.com/mem0ai/mem0/graphs/contributors">
<img src="https://contrib.rocks/image?repo=mem0ai/mem0" />
</a>
## Anonymous Telemetry
We collect anonymous usage metrics to enhance our package's quality and user experience. This includes data like feature usage frequency and system info, but never personal details. The data helps us prioritize improvements and ensure compatibility. If you wish to opt-out, set the environment variable `EC_TELEMETRY=false`. We prioritize data security and don't share this data externally.
We collect anonymous usage metrics to enhance our package's quality and user experience. This includes data like feature usage frequency and system info, but never personal details. The data helps us prioritize improvements and ensure compatibility. If you wish to opt-out, set the environment variable MEM0_TELEMETRY=false. We prioritize data security and don't share this data externally.
## Citation
## License
If you utilize this repository, please consider citing it with:
```
@misc{embedchain,
author = {Taranjeet Singh, Deshraj Yadav},
title = {Embedchain: The Open Source RAG Framework},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/embedchain/embedchain}},
}
```
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
-12
View File
@@ -1,12 +0,0 @@
llm:
provider: ollama
config:
model: 'llama2'
temperature: 0.5
top_p: 1
stream: true
embedder:
provider: huggingface
config:
model: 'BAAI/bge-small-en-v1.5'
+239
View File
@@ -0,0 +1,239 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"from typing import List, Dict\n",
"from mem0 import Memory\n",
"from datetime import datetime\n",
"import anthropic\n",
"\n",
"# Set up environment variables\n",
"os.environ[\"OPENAI_API_KEY\"] = \"your_openai_api_key\" # needed for embedding model\n",
"os.environ[\"ANTHROPIC_API_KEY\"] = \"your_anthropic_api_key\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"class SupportChatbot:\n",
" def __init__(self):\n",
" # Initialize Mem0 with Anthropic's Claude\n",
" self.config = {\n",
" \"llm\": {\n",
" \"provider\": \"anthropic\",\n",
" \"config\": {\n",
" \"model\": \"claude-3-5-sonnet-latest\",\n",
" \"temperature\": 0.1,\n",
" \"max_tokens\": 2000,\n",
" }\n",
" }\n",
" }\n",
" self.client = anthropic.Client(api_key=os.environ[\"ANTHROPIC_API_KEY\"])\n",
" self.memory = Memory.from_config(self.config)\n",
"\n",
" # Define support context\n",
" self.system_context = \"\"\"\n",
" You are a helpful customer support agent. Use the following guidelines:\n",
" - Be polite and professional\n",
" - Show empathy for customer issues\n",
" - Reference past interactions when relevant\n",
" - Maintain consistent information across conversations\n",
" - If you're unsure about something, ask for clarification\n",
" - Keep track of open issues and follow-ups\n",
" \"\"\"\n",
"\n",
" def store_customer_interaction(self,\n",
" user_id: str,\n",
" message: str,\n",
" response: str,\n",
" metadata: Dict = None):\n",
" \"\"\"Store customer interaction in memory.\"\"\"\n",
" if metadata is None:\n",
" metadata = {}\n",
"\n",
" # Add timestamp to metadata\n",
" metadata[\"timestamp\"] = datetime.now().isoformat()\n",
"\n",
" # Format conversation for storage\n",
" conversation = [\n",
" {\"role\": \"user\", \"content\": message},\n",
" {\"role\": \"assistant\", \"content\": response}\n",
" ]\n",
"\n",
" # Store in Mem0\n",
" self.memory.add(\n",
" conversation,\n",
" user_id=user_id,\n",
" metadata=metadata\n",
" )\n",
"\n",
" def get_relevant_history(self, user_id: str, query: str) -> List[Dict]:\n",
" \"\"\"Retrieve relevant past interactions.\"\"\"\n",
" return self.memory.search(\n",
" query=query,\n",
" user_id=user_id,\n",
" limit=5 # Adjust based on needs\n",
" )\n",
"\n",
" def handle_customer_query(self, user_id: str, query: str) -> str:\n",
" \"\"\"Process customer query with context from past interactions.\"\"\"\n",
"\n",
" # Get relevant past interactions\n",
" relevant_history = self.get_relevant_history(user_id, query)\n",
"\n",
" # Build context from relevant history\n",
" context = \"Previous relevant interactions:\\n\"\n",
" for memory in relevant_history:\n",
" context += f\"Customer: {memory['memory']}\\n\"\n",
" context += f\"Support: {memory['memory']}\\n\"\n",
" context += \"---\\n\"\n",
"\n",
" # Prepare prompt with context and current query\n",
" prompt = f\"\"\"\n",
" {self.system_context}\n",
"\n",
" {context}\n",
"\n",
" Current customer query: {query}\n",
"\n",
" Provide a helpful response that takes into account any relevant past interactions.\n",
" \"\"\"\n",
"\n",
" # Generate response using Claude\n",
" response = self.client.messages.create(\n",
" model=\"claude-3-5-sonnet-latest\",\n",
" messages=[{\"role\": \"user\", \"content\": prompt}],\n",
" max_tokens=2000,\n",
" temperature=0.1\n",
" )\n",
"\n",
" # Store interaction\n",
" self.store_customer_interaction(\n",
" user_id=user_id,\n",
" message=query,\n",
" response=response,\n",
" metadata={\"type\": \"support_query\"}\n",
" )\n",
"\n",
" return response.content[0].text"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to Customer Support! Type 'exit' to end the conversation.\n",
"Customer: Hi, I'm having trouble connecting my new smartwatch to the mobile app. It keeps showing a connection error.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/var/folders/5x/9kmqjfm947g5yh44m7fjk75r0000gn/T/ipykernel_99777/1076713094.py:55: DeprecationWarning: The current get_all API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" return self.memory.search(\n",
"/var/folders/5x/9kmqjfm947g5yh44m7fjk75r0000gn/T/ipykernel_99777/1076713094.py:47: DeprecationWarning: The current add API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" self.memory.add(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Support: Hello! Thank you for reaching out about the connection issue with your smartwatch. I understand how frustrating it can be when a new device won't connect properly. I'll be happy to help you resolve this.\n",
"\n",
"To better assist you, could you please provide me with:\n",
"1. The model of your smartwatch\n",
"2. The type of phone you're using (iOS or Android)\n",
"3. Whether you've already installed the companion app on your phone\n",
"4. If you've tried pairing the devices before\n",
"\n",
"These details will help me provide you with the most accurate troubleshooting steps. In the meantime, here are some general tips that might help:\n",
"- Make sure Bluetooth is enabled on your phone\n",
"- Keep your smartwatch and phone within close range (within 3 feet) during pairing\n",
"- Ensure both devices have sufficient battery power\n",
"- Check if your phone's operating system meets the minimum requirements for the smartwatch\n",
"\n",
"Please provide the requested information, and I'll guide you through the specific steps to resolve the connection error.\n",
"\n",
"Is there anything else you'd like to share about the issue? \n",
"\n",
"\n",
"Customer: The connection issue is still happening even after trying the steps you suggested.\n",
"Support: I apologize that you're still experiencing connection issues with your smartwatch. I understand how frustrating it must be to have this problem persist even after trying the initial troubleshooting steps. Let's try some additional solutions to resolve this.\n",
"\n",
"Before we proceed, could you please confirm:\n",
"1. Which specific steps you've already attempted?\n",
"2. Are you seeing any particular error message?\n",
"3. What model of smartwatch and phone are you using?\n",
"\n",
"This information will help me provide more targeted solutions and avoid suggesting steps you've already tried. In the meantime, here are a few advanced troubleshooting steps we can consider:\n",
"\n",
"1. Completely resetting the Bluetooth connection\n",
"2. Checking for any software updates for both the watch and phone\n",
"3. Testing the connection with a different mobile device to isolate the issue\n",
"\n",
"Would you be able to provide those details so I can better assist you? I'll make sure to document this ongoing issue to help track its resolution. \n",
"\n",
"\n",
"Customer: exit\n",
"Thank you for using our support service. Goodbye!\n"
]
}
],
"source": [
"chatbot = SupportChatbot()\n",
"user_id = \"customer_bot\"\n",
"print(\"Welcome to Customer Support! Type 'exit' to end the conversation.\")\n",
"\n",
"while True:\n",
" # Get user input\n",
" query = input()\n",
" print(\"Customer:\", query)\n",
" \n",
" # Check if user wants to exit\n",
" if query.lower() == 'exit':\n",
" print(\"Thank you for using our support service. Goodbye!\")\n",
" break\n",
" \n",
" # Handle the query and print the response\n",
" response = chatbot.handle_customer_query(user_id, query)\n",
" print(\"Support:\", response, \"\\n\\n\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
+170
View File
@@ -0,0 +1,170 @@
# Copyright (c) 2023 - 2024, Owners of https://github.com/autogen-ai
#
# SPDX-License-Identifier: Apache-2.0
#
# Portions derived from https://github.com/microsoft/autogen are under the MIT License.
# SPDX-License-Identifier: MIT
# forked from autogen.agentchat.contrib.capabilities.teachability.Teachability
from typing import Dict, Optional, Union
from autogen.agentchat.assistant_agent import ConversableAgent
from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability
from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent
from termcolor import colored
from mem0 import Memory
class Mem0Teachability(AgentCapability):
def __init__(
self,
verbosity: Optional[int] = 0,
reset_db: Optional[bool] = False,
recall_threshold: Optional[float] = 1.5,
max_num_retrievals: Optional[int] = 10,
llm_config: Optional[Union[Dict, bool]] = None,
agent_id: Optional[str] = None,
memory_client: Optional[Memory] = None,
):
self.verbosity = verbosity
self.recall_threshold = recall_threshold
self.max_num_retrievals = max_num_retrievals
self.llm_config = llm_config
self.analyzer = None
self.teachable_agent = None
self.agent_id = agent_id
self.memory = memory_client if memory_client else Memory()
if reset_db:
self.memory.reset()
def add_to_agent(self, agent: ConversableAgent):
self.teachable_agent = agent
agent.register_hook(hookable_method="process_last_received_message", hook=self.process_last_received_message)
if self.llm_config is None:
self.llm_config = agent.llm_config
assert self.llm_config, "Teachability requires a valid llm_config."
self.analyzer = TextAnalyzerAgent(llm_config=self.llm_config)
agent.update_system_message(
agent.system_message
+ "\nYou've been given the special ability to remember user teachings from prior conversations."
)
def process_last_received_message(self, text: Union[Dict, str]):
expanded_text = text
if self.memory.get_all(agent_id=self.agent_id):
expanded_text = self._consider_memo_retrieval(text)
self._consider_memo_storage(text)
return expanded_text
def _consider_memo_storage(self, comment: Union[Dict, str]):
response = self._analyze(
comment,
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.",
)
if "yes" in response.lower():
advice = self._analyze(
comment,
"Briefly copy any advice from the TEXT that may be useful for a similar but different task in the future. But if no advice is present, just respond with 'none'.",
)
if "none" not in advice.lower():
task = self._analyze(
comment,
"Briefly copy just the task from the TEXT, then stop. Don't solve it, and don't include any advice.",
)
general_task = self._analyze(
task,
"Summarize very briefly, in general terms, the type of task described in the TEXT. Leave out details that might not appear in a similar problem.",
)
if self.verbosity >= 1:
print(colored("\nREMEMBER THIS TASK-ADVICE PAIR", "light_yellow"))
self.memory.add(
[{"role": "user", "content": f"Task: {general_task}\nAdvice: {advice}"}], agent_id=self.agent_id
)
response = self._analyze(
comment,
"Does the TEXT contain information that could be committed to memory? Answer with just one word, yes or no.",
)
if "yes" in response.lower():
question = self._analyze(
comment,
"Imagine that the user forgot this information in the TEXT. How would they ask you for this information? Include no other text in your response.",
)
answer = self._analyze(
comment, "Copy the information from the TEXT that should be committed to memory. Add no explanation."
)
if self.verbosity >= 1:
print(colored("\nREMEMBER THIS QUESTION-ANSWER PAIR", "light_yellow"))
self.memory.add(
[{"role": "user", "content": f"Question: {question}\nAnswer: {answer}"}], agent_id=self.agent_id
)
def _consider_memo_retrieval(self, comment: Union[Dict, str]):
if self.verbosity >= 1:
print(colored("\nLOOK FOR RELEVANT MEMOS, AS QUESTION-ANSWER PAIRS", "light_yellow"))
memo_list = self._retrieve_relevant_memos(comment)
response = self._analyze(
comment,
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.",
)
if "yes" in response.lower():
if self.verbosity >= 1:
print(colored("\nLOOK FOR RELEVANT MEMOS, AS TASK-ADVICE PAIRS", "light_yellow"))
task = self._analyze(
comment, "Copy just the task from the TEXT, then stop. Don't solve it, and don't include any advice."
)
general_task = self._analyze(
task,
"Summarize very briefly, in general terms, the type of task described in the TEXT. Leave out details that might not appear in a similar problem.",
)
memo_list.extend(self._retrieve_relevant_memos(general_task))
memo_list = list(set(memo_list))
return comment + self._concatenate_memo_texts(memo_list)
def _retrieve_relevant_memos(self, input_text: str) -> list:
search_results = self.memory.search(input_text, agent_id=self.agent_id, limit=self.max_num_retrievals)
memo_list = [result["memory"] for result in search_results if result["score"] <= self.recall_threshold]
if self.verbosity >= 1 and not memo_list:
print(colored("\nTHE CLOSEST MEMO IS BEYOND THE THRESHOLD:", "light_yellow"))
if search_results["results"]:
print(search_results["results"][0])
print()
return memo_list
def _concatenate_memo_texts(self, memo_list: list) -> str:
memo_texts = ""
if memo_list:
info = "\n# Memories that might help\n"
for memo in memo_list:
info += f"- {memo}\n"
if self.verbosity >= 1:
print(colored(f"\nMEMOS APPENDED TO LAST MESSAGE...\n{info}\n", "light_yellow"))
memo_texts += "\n" + info
return memo_texts
def _analyze(self, text_to_analyze: Union[Dict, str], analysis_instructions: Union[Dict, str]):
self.analyzer.reset()
self.teachable_agent.send(
recipient=self.analyzer, message=text_to_analyze, request_reply=False, silent=(self.verbosity < 2)
)
self.teachable_agent.send(
recipient=self.analyzer, message=analysis_instructions, request_reply=True, silent=(self.verbosity < 2)
)
return self.teachable_agent.last_message(self.analyzer)["content"]
File diff suppressed because it is too large Load Diff
+11 -4
View File
@@ -1,7 +1,14 @@
# Contributing to embedchain docs
# Mintlify Starter Kit
Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including
### 👩‍💻 Development
- Guide pages
- Navigation
- Customizations
- API Reference pages
- Use of popular components
### Development
Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command
@@ -15,9 +22,9 @@ Run the following command at the root of your documentation (where mint.json is)
mintlify dev
```
### 😎 Publishing Changes
### Publishing Changes
Changes will be deployed to production automatically after your PR is merged to the main branch.
Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
#### Troubleshooting
+6 -6
View File
@@ -1,11 +1,11 @@
<CardGroup cols={3}>
<Card title="Talk to founders" icon="calendar" href="https://cal.com/taranjeetio/ec">
Schedule a call
<Card title="Discord" icon="discord" href="https://mem0.dev/DiD" color="#7289DA">
Join our community
</Card>
<Card title="Slack" icon="slack" href="https://embedchain.ai/slack" color="#4A154B">
Join our slack community
<Card title="GitHub" icon="github" href="https://github.com/mem0ai/mem0/discussions/new?category=q-a">
Ask questions on GitHub
</Card>
<Card title="Discord" icon="discord" href="https://discord.gg/6PzXDgEjG5" color="#7289DA">
Join our discord community
<Card title="Support" icon="calendar" href="https://cal.com/taranjeetio/meet">
Talk to founders
</Card>
</CardGroup>
@@ -0,0 +1,4 @@
---
title: 'Delete User'
openapi: delete /v1/entities/{entity_type}/{entity_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Get Users'
openapi: get /v1/entities/
---
@@ -0,0 +1,4 @@
---
title: 'Add Memories'
openapi: post /v1/memories/
---
@@ -0,0 +1,4 @@
---
title: 'Batch Delete Memories'
openapi: delete /v1/batch/
---
@@ -0,0 +1,4 @@
---
title: 'Batch Update Memories'
openapi: put /v1/batch/
---
@@ -0,0 +1,6 @@
---
title: 'Create Memory Export'
openapi: post /v1/exports/
---
Submit a job to create a structured export of memories using a customizable Pydantic schema. This process may take some time to complete, especially if you’re exporting a large number of memories. You can tailor the export by applying various filters (e.g., user_id, agent_id, run_id, or session_id) and by modifying the Pydantic schema to ensure the final data matches your exact needs.
@@ -0,0 +1,4 @@
---
title: 'Delete Memories'
openapi: delete /v1/memories/
---
@@ -0,0 +1,4 @@
---
title: 'Delete Memory'
openapi: delete /v1/memories/{memory_id}/
---
@@ -0,0 +1,6 @@
---
title: 'Get Memory Export'
openapi: get /v1/exports/
---
Retrieve the latest structured memory export after submitting an export job. You can filter the export by `user_id`, `run_id`, `session_id`, or `app_id` to get the most recent export matching your filters.
+4
View File
@@ -0,0 +1,4 @@
---
title: 'Get Memory'
openapi: get /v1/memories/{memory_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Memory History'
openapi: get /v1/memories/{memory_id}/history/
---
@@ -0,0 +1,4 @@
---
title: 'Update Memory'
openapi: put /v1/memories/{memory_id}/
---
@@ -0,0 +1,4 @@
---
title: 'V1 Get Memories'
openapi: get /v1/memories/
---
@@ -0,0 +1,4 @@
---
title: 'V1 Search Memories'
openapi: post /v1/memories/search/
---
@@ -0,0 +1,74 @@
---
title: 'V2 Get Memories'
openapi: post /v2/memories/
---
Mem0 offers two versions of the get memories API: v1 and v2. Here's how they differ:
<Tabs>
<Tab title="v1 Get Memories">
<CodeGroup>
```python Code
memories = m.get_all(user_id="alex")
```
```json Output
[
{
"id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7",
"memory":"travelling to Paris",
"user_id":"alex",
"hash":"62bc074f56d1f909f1b4c2b639f56f6a",
"metadata":null,
"created_at":"2023-02-25T23:57:00.108347-07:00",
"updated_at":"2024-07-25T23:57:00.108367-07:00"
}
]
```
</CodeGroup>
</Tab>
<Tab title="v2 Get Memories">
<CodeGroup>
```python Code
memories = m.get_all(
filters={
"AND": [
{
"user_id": "alex"
},
{
"created_at": {
"gte": "2024-07-01",
"lte": "2024-07-31"
}
}
]
},
version="v2"
)
```
```json Output
[
{
"id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7",
"memory":"Name: Alex. Vegetarian. Allergic to nuts.",
"user_id":"alex",
"hash":"62bc074f56d1f909f1b4c2b639f56f6a",
"metadata":null,
"created_at":"2024-07-25T23:57:00.108347-07:00",
"updated_at":"2024-07-25T23:57:00.108367-07:00"
}
]
```
</CodeGroup>
</Tab>
</Tabs>
Key difference between v1 and v2 get memories:
• **Filters**: v2 allows you to apply filters to narrow down memory retrieval based on specific criteria. This includes support for complex logical operations (AND, OR) and comparison operators (IN, gte, lte, gt, lt, ne, icontains) for advanced filtering capabilities.
The v2 get memories API is more powerful and flexible, allowing for more precise memory retrieval without the need for a search query.
@@ -0,0 +1,85 @@
---
title: 'V2 Search Memories'
openapi: post /v2/memories/search/
---
Mem0 offers two versions of the search API: v1 and v2. Here's how they differ:
<Tabs>
<Tab title="v1 Search">
<CodeGroup>
```python Code
related_memories = m.search(query="What are Alice's hobbies?", user_id="alice")
```
```json Output
[
{
"id":"ea925981-272f-40dd-b576-be64e4871429",
"memory":"Likes to play cricket and plays cricket on weekends.",
"hash":"c8809002-25c1-4c97-a3a2-227ce9c20c53",
"metadata":{
"category":"hobbies"
},
"score":0.32116443111457704,
"created_at":"2024-07-26T10:29:36.630547-07:00",
"updated_at":"None",
"user_id":"alice"
}
]
```
</CodeGroup>
</Tab>
<Tab title="v2 Search">
<CodeGroup>
```python Code
related_memories = m.vsearch(
query="What are Alice's hobbies?",
filters={
"AND":[
{
"user_id":"alice"
},
{
"agent_id":{
"in":[
"travelling",
"sports"
]
}
}
]
},
version="v2"
)
```
```json Output
{
"memories": [
{
"id": "ea925981-272f-40dd-b576-be64e4871429",
"memory": "Likes to play cricket and plays cricket on weekends.",
"hash": "c8809002-25c1-4c97-a3a2-227ce9c20c53",
"metadata": {
"category": "hobbies"
},
"score": 0.32116443111457704,
"created_at": "2024-07-26T10:29:36.630547-07:00",
"updated_at": null,
"user_id": "alice",
"agent_id": "sports"
}
],
}
```
</CodeGroup>
</Tab>
</Tabs>
Key difference between v1 and v2 search:
• **Filters**: v2 allows you to apply filters to narrow down search results based on specific criteria. This includes support for complex logical operations (AND, OR) and comparison operators (IN, gte, lte, gt, lt, ne, icontains) for advanced filtering capabilities.
The v2 search API is more powerful and flexible, allowing for more precise memory retrieval.
@@ -0,0 +1,9 @@
---
title: 'Add Member'
openapi: post /api/v1/orgs/organizations/{org_id}/members/
---
The API provides two roles for organization members:
- `READER`: Allows viewing of organization resources.
- `OWNER`: Grants full administrative access to manage the organization and its resources.
@@ -0,0 +1,4 @@
---
title: 'Create Organization'
openapi: post /api/v1/orgs/organizations/
---
@@ -0,0 +1,4 @@
---
title: 'Delete Member'
openapi: delete /api/v1/orgs/organizations/{org_id}/members/
---
@@ -0,0 +1,4 @@
---
title: 'Delete Organization'
openapi: delete /api/v1/orgs/organizations/{org_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Get Members'
openapi: get /api/v1/orgs/organizations/{org_id}/members/
---
@@ -0,0 +1,4 @@
---
title: 'Get Organization'
openapi: get /api/v1/orgs/organizations/{org_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Get Organizations'
openapi: get /api/v1/orgs/organizations/
---
@@ -0,0 +1,9 @@
---
title: 'Update Member'
openapi: put /api/v1/orgs/organizations/{org_id}/members/
---
The API provides two roles for organization members:
- `READER`: Allows viewing of organization resources.
- `OWNER`: Grants full administrative access to manage the organization and its resources.
+69
View File
@@ -0,0 +1,69 @@
# Mem0 API Overview
Mem0 provides a powerful set of APIs that allow you to integrate advanced memory management capabilities into your applications. Our APIs are designed to be intuitive, efficient, and scalable, enabling you to create, retrieve, update, and delete memories across various entities such as users, agents, apps, and runs.
## Key Features
- **Memory Management**: Add, retrieve, update, and delete memories with ease.
- **Entity-based Operations**: Perform operations on memories associated with specific users, agents, apps, or runs.
- **Advanced Search**: Utilize our search API to find relevant memories based on various criteria.
- **History Tracking**: Access the history of memory interactions for comprehensive analysis.
- **User Management**: Manage user entities and their associated memories.
## API Structure
Our API is organized into several main categories:
1. **Memory APIs**: Core operations for managing individual memories and collections.
2. **Entities APIs**: Manage different entity types (users, agents, etc.) and their associated memories.
3. **Search API**: Advanced search functionality to retrieve relevant memories.
4. **History API**: Track and retrieve the history of memory interactions.
## Authentication
All API requests require authentication using HTTP Basic Auth. Ensure you include your API key in the Authorization header of each request.
## Organizations and projects (optional)
Organizations and projects provide the following capabilities:
- **Multi-org/project Support**: Specify organization and project when initializing the Mem0 client to attribute API usage appropriately
- **Member Management**: Control access to data through organization and project membership
- **Access Control**: Only members can access memories and data within their organization/project scope
- **Team Isolation**: Maintain data separation between different teams and projects for secure collaboration
Example with the mem0 Python package:
```python
from mem0 import MemoryClient
# Recommended: Using organization and project IDs
client = MemoryClient(
org_id='YOUR_ORG_ID', # It can be found on the organization settings page in dashboard
project_id='YOUR_PROJECT_ID',
)
```
> **Note**: The use of `organization` and `project` parameters is deprecated and will be removed in version `0.1.40`. Please use `org_id` and `project_id` instead.
Example with the mem0 Node.js package:
```javascript
import { MemoryClient } from "mem0ai";
# Recommended: Using organization and project IDs
const client = new MemoryClient({
organizationId: "YOUR_ORG_ID",
projectId: "YOUR_PROJECT_ID"
});
```
## Getting Started
To begin using the Mem0 API, you'll need to:
1. Sign up for a [Mem0 account](https://app.mem0.ai) and obtain your API key.
2. Familiarize yourself with the API endpoints and their functionalities.
3. Make your first API call to add or retrieve a memory.
Explore the detailed documentation for each API endpoint to learn more about request/response formats, parameters, and example usage.
@@ -0,0 +1,9 @@
---
title: 'Add Member'
openapi: post /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
---
The API provides two roles for project members:
- `READER`: Allows viewing of project resources.
- `OWNER`: Grants full administrative access to manage the project and its resources.
@@ -0,0 +1,4 @@
---
title: 'Create Project'
openapi: post /api/v1/orgs/organizations/{org_id}/projects/
---
@@ -0,0 +1,4 @@
---
title: 'Delete Member'
openapi: delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
---
@@ -0,0 +1,4 @@
---
title: 'Delete Project'
openapi: delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Get Members'
openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
---
@@ -0,0 +1,4 @@
---
title: 'Get Project'
openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/
---
@@ -0,0 +1,4 @@
---
title: 'Get Projects'
openapi: get /api/v1/orgs/organizations/{org_id}/projects/
---
@@ -0,0 +1,9 @@
---
title: 'Update Member'
openapi: put /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
---
The API provides two roles for project members:
- `READER`: Allows viewing of project resources.
- `OWNER`: Grants full administrative access to manage the project and its resources.
@@ -0,0 +1,4 @@
---
title: 'Update Project'
openapi: patch /api/v1/orgs/organizations/{org_id}/projects/{project_id}/
---
+61
View File
@@ -0,0 +1,61 @@
## What is Config?
Config in mem0 is a dictionary that specifies the settings for your embedding models. It allows you to customize the behavior and connection details of your chosen embedder.
## How to Define Config
The config is defined as a Python dictionary with two main keys:
- `embedder`: Specifies the embedder provider and its configuration
- `provider`: The name of the embedder (e.g., "openai", "ollama")
- `config`: A nested dictionary containing provider-specific settings
## How to Use Config
Here's a general example of how to use the config with mem0:
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"embedder": {
"provider": "your_chosen_provider",
"config": {
# Provider-specific settings go here
}
}
}
m = Memory.from_config(config)
m.add("Your text here", user_id="user", metadata={"category": "example"})
```
## Why is Config Needed?
Config is essential for:
1. Specifying which embedding model to use.
2. Providing necessary connection details (e.g., model, api_key, embedding_dims).
3. Ensuring proper initialization and connection to your chosen embedder.
## Master List of All Params in Config
Here's a comprehensive list of all parameters that can be used across different embedders:
| Parameter | Description |
|-----------|-------------|
| `model` | Embedding model to use |
| `api_key` | API key of the provider |
| `embedding_dims` | Dimensions of the embedding model |
| `http_client_proxies` | Allow proxy server settings |
| `ollama_base_url` | Base URL for the Ollama embedding model |
| `model_kwargs` | Key-Value arguments for the Huggingface embedding model |
| `azure_kwargs` | Key-Value arguments for the AzureOpenAI embedding model |
| `openai_base_url` | Base URL for OpenAI API | OpenAI |
| `vertex_credentials_json` | Path to the Google Cloud credentials JSON file for VertexAI |
## Supported Embedding Models
For detailed information on configuring specific embedders, please visit the [Embedding Models](./models) section. There you'll find information for each supported embedder with provider-specific usage examples and configuration details.
@@ -0,0 +1,51 @@
---
title: Azure OpenAI
---
To use Azure OpenAI embedding models, set the `EMBEDDING_AZURE_OPENAI_API_KEY`, `EMBEDDING_AZURE_DEPLOYMENT`, `EMBEDDING_AZURE_ENDPOINT` and `EMBEDDING_AZURE_API_VERSION` environment variables. You can obtain the Azure OpenAI API key from the Azure.
### Usage
```python
import os
from mem0 import Memory
os.environ["EMBEDDING_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["EMBEDDING_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["EMBEDDING_AZURE_ENDPOINT"] = "your-api-base-url"
os.environ["EMBEDDING_AZURE_API_VERSION"] = "version-to-use"
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "azure_openai",
"config": {
"model": "text-embedding-3-large"
"azure_kwargs": {
"api_version": "",
"azure_deployment": "",
"azure_endpoint": "",
"api_key": "",
"default_headers": {
"CustomHeader": "your-custom-header",
}
}
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring Azure OpenAI embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `azure_kwargs` | The Azure OpenAI configs | `config_keys` |
@@ -0,0 +1,37 @@
---
title: Gemini
---
To use Gemini embedding models, set the `GOOGLE_API_KEY` environment variables. You can obtain the Gemini API key from [here](https://aistudio.google.com/app/apikey).
### Usage
```python
import os
from mem0 import Memory
os.environ["GOOGLE_API_KEY"] = "key"
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "gemini",
"config": {
"model": "models/text-embedding-004",
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring Gemini embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `models/text-embedding-004` |
| `embedding_dims` | Dimensions of the embedding model | `768` |
| `api_key` | The Gemini API key | `None` |
@@ -0,0 +1,36 @@
---
title: Hugging Face
---
You can use embedding models from Huggingface to run Mem0 locally.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "huggingface",
"config": {
"model": "multi-qa-MiniLM-L6-cos-v1"
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring Huggingface embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the model to use | `multi-qa-MiniLM-L6-cos-v1` |
| `embedding_dims` | Dimensions of the embedding model | `selected_model_dimensions` |
| `model_kwargs` | Additional arguments for the model | `None` |
@@ -0,0 +1,32 @@
You can use embedding models from Ollama to run Mem0 locally.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "ollama",
"config": {
"model": "mxbai-embed-large"
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring Ollama embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the OpenAI model to use | `nomic-embed-text` |
| `embedding_dims` | Dimensions of the embedding model | `512` |
| `ollama_base_url` | Base URL for ollama connection | `None` |
@@ -0,0 +1,36 @@
---
title: OpenAI
---
To use OpenAI embedding models, set the `OPENAI_API_KEY` environment variable. You can obtain the OpenAI API key from the [OpenAI Platform](https://platform.openai.com/account/api-keys).
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your_api_key"
config = {
"embedder": {
"provider": "openai",
"config": {
"model": "text-embedding-3-large"
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring OpenAI embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `api_key` | The OpenAI API key | `None` |
@@ -0,0 +1,39 @@
---
title: Together
---
To use Together embedding models, set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from the [Together Platform](https://api.together.xyz/settings/api-keys).
### Usage
<Note> The `embedding_model_dims` parameter for `vector_store` should be set to `768` for Together embedder. </Note>
```python
import os
from mem0 import Memory
os.environ["TOGETHER_API_KEY"] = "your_api_key"
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "together",
"config": {
"model": "togethercomputer/m2-bert-80M-8k-retrieval"
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring Together embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `togethercomputer/m2-bert-80M-8k-retrieval` |
| `embedding_dims` | Dimensions of the embedding model | `768` |
| `api_key` | The Together API key | `None` |
@@ -0,0 +1,36 @@
### Vertex AI
To use Google Cloud's Vertex AI for text embedding models, set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to the path of your service account's credentials JSON file. These credentials can be created in the [Google Cloud Console](https://console.cloud.google.com/).
### Usage
```python
import os
from mem0 import Memory
# Set the path to your Google Cloud credentials JSON file
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/your/credentials.json"
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
config = {
"embedder": {
"provider": "vertexai",
"config": {
"model": "text-embedding-004"
}
}
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
```
### Config
Here are the parameters available for configuring the Vertex AI embedder:
| Parameter | Description | Default Value |
| ------------------------- | ------------------------------------------------ | -------------------- |
| `model` | The name of the Vertex AI embedding model to use | `text-embedding-004` |
| `vertex_credentials_json` | Path to the Google Cloud credentials JSON file | `None` |
| `embedding_dims` | Dimensions of the embedding model | `256` |
+25
View File
@@ -0,0 +1,25 @@
---
title: Overview
---
Mem0 offers support for various embedding models, allowing users to choose the one that best suits their needs.
## Supported Embedders
See the list of supported embedders below.
<CardGroup cols={4}>
<Card title="OpenAI" href="/components/embedders/models/openai"></Card>
<Card title="Azure OpenAI" href="/components/embedders/models/azure_openai"></Card>
<Card title="Ollama" href="/components/embedders/models/ollama"></Card>
<Card title="Hugging Face" href="/components/embedders/models/huggingface"></Card>
<Card title="Gemini" href="/components/embedders/models/gemini"></Card>
<Card title="Vertex AI" href="/components/embedders/models/vertexai"></Card>
<Card title="Together" href="/components/embedders/models/together"></Card>
</CardGroup>
## Usage
To utilize a embedder, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and `OpenAI` will be used as the embedder.
For a comprehensive list of available parameters for embedder configuration, please refer to [Config](./config).
-222
View File
@@ -1,222 +0,0 @@
---
title: 🧩 Embedding models
---
## Overview
Embedchain supports several embedding models from the following providers:
<CardGroup cols={4}>
<Card title="OpenAI" href="#openai"></Card>
<Card title="GoogleAI" href="#google-ai"></Card>
<Card title="Azure OpenAI" href="#azure-openai"></Card>
<Card title="GPT4All" href="#gpt4all"></Card>
<Card title="Hugging Face" href="#hugging-face"></Card>
<Card title="Vertex AI" href="#vertex-ai"></Card>
</CardGroup>
## OpenAI
To use OpenAI embedding function, you have to set the `OPENAI_API_KEY` environment variable. You can obtain the OpenAI API key from the [OpenAI Platform](https://platform.openai.com/account/api-keys).
Once you have obtained the key, you can use it like this:
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'xxx'
# load embedding model configuration from config.yaml file
app = App.from_config(config_path="config.yaml")
app.add("https://en.wikipedia.org/wiki/OpenAI")
app.query("What is OpenAI?")
```
```yaml config.yaml
embedder:
provider: openai
config:
model: 'text-embedding-3-small'
```
</CodeGroup>
* OpenAI announced two new embedding models: `text-embedding-3-small` and `text-embedding-3-large`. Embedchain supports both these models. Below you can find YAML config for both:
<CodeGroup>
```yaml text-embedding-3-small.yaml
embedder:
provider: openai
config:
model: 'text-embedding-3-small'
```
```yaml text-embedding-3-large.yaml
embedder:
provider: openai
config:
model: 'text-embedding-3-large'
```
</CodeGroup>
## Google AI
To use Google AI embedding function, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ["GOOGLE_API_KEY"] = "xxx"
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
embedder:
provider: google
config:
model: 'models/embedding-001'
task_type: "retrieval_document"
title: "Embeddings for Embedchain"
```
</CodeGroup>
<br/>
<Note>
For more details regarding the Google AI embedding model, please refer to the [Google AI documentation](https://ai.google.dev/tutorials/python_quickstart#use_embeddings).
</Note>
## Azure OpenAI
To use Azure OpenAI embedding model, you have to set some of the azure openai related environment variables as given in the code block below:
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://xxx.openai.azure.com/"
os.environ["AZURE_OPENAI_API_KEY"] = "xxx"
os.environ["OPENAI_API_VERSION"] = "xxx"
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
llm:
provider: azure_openai
config:
model: gpt-35-turbo
deployment_name: your_llm_deployment_name
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
embedder:
provider: azure_openai
config:
model: text-embedding-ada-002
deployment_name: you_embedding_model_deployment_name
```
</CodeGroup>
You can find the list of models and deployment name on the [Azure OpenAI Platform](https://oai.azure.com/portal).
## GPT4ALL
GPT4All supports generating high quality embeddings of arbitrary length documents of text using a CPU optimized contrastively trained Sentence Transformer.
<CodeGroup>
```python main.py
from embedchain import App
# load embedding model configuration from config.yaml file
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
llm:
provider: gpt4all
config:
model: 'orca-mini-3b-gguf2-q4_0.gguf'
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
embedder:
provider: gpt4all
```
</CodeGroup>
## Hugging Face
Hugging Face supports generating embeddings of arbitrary length documents of text using Sentence Transformer library. Example of how to generate embeddings using hugging face is given below:
<CodeGroup>
```python main.py
from embedchain import App
# load embedding model configuration from config.yaml file
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
llm:
provider: huggingface
config:
model: 'google/flan-t5-xxl'
temperature: 0.5
max_tokens: 1000
top_p: 0.5
stream: false
embedder:
provider: huggingface
config:
model: 'sentence-transformers/all-mpnet-base-v2'
```
</CodeGroup>
## Vertex AI
Embedchain supports Google's VertexAI embeddings model through a simple interface. You just have to pass the `model_name` in the config yaml and it would work out of the box.
<CodeGroup>
```python main.py
from embedchain import App
# load embedding model configuration from config.yaml file
app = App.from_config(config_path="config.yaml")
```
```yaml config.yaml
llm:
provider: vertexai
config:
model: 'chat-bison'
temperature: 0.5
top_p: 0.5
embedder:
provider: vertexai
config:
model: 'textembedding-gecko'
```
</CodeGroup>
+79
View File
@@ -0,0 +1,79 @@
## What is Config?
Config in mem0 is a dictionary that specifies the settings for your llms. It allows you to customize the behavior and connection details of your chosen llm.
## How to Define Config
The config is defined as a Python dictionary with two main keys:
- `llm`: Specifies the llm provider and its configuration
- `provider`: The name of the llm (e.g., "openai", "groq")
- `config`: A nested dictionary containing provider-specific settings
### Config Values Precedence
Config values are applied in the following order of precedence (from highest to lowest):
1. Values explicitly set in the `config` dictionary
2. Environment variables (e.g., `OPENAI_API_KEY`, `OPENAI_API_BASE`)
3. Default values defined in the LLM implementation
This means that values specified in the `config` dictionary will override corresponding environment variables, which in turn override default values.
## How to Use Config
Here's a general example of how to use the config with mem0:
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx" # for embedder
config = {
"llm": {
"provider": "your_chosen_provider",
"config": {
# Provider-specific settings go here
}
}
}
m = Memory.from_config(config)
m.add("Your text here", user_id="user", metadata={"category": "example"})
```
## Why is Config Needed?
Config is essential for:
1. Specifying which llm to use.
2. Providing necessary connection details (e.g., model, api_key, temperature).
3. Ensuring proper initialization and connection to your chosen llm.
## Master List of All Params in Config
Here's a comprehensive list of all parameters that can be used across different llms:
Here's the table based on the provided parameters:
| Parameter | Description | Provider |
|----------------------|-----------------------------------------------|-------------------|
| `model` | Embedding model to use | All |
| `temperature` | Temperature of the model | All |
| `api_key` | API key to use | All |
| `max_tokens` | Tokens to generate | All |
| `top_p` | Probability threshold for nucleus sampling | All |
| `top_k` | Number of highest probability tokens to keep | All |
| `http_client_proxies`| Allow proxy server settings | AzureOpenAI |
| `models` | List of models | Openrouter |
| `route` | Routing strategy | Openrouter |
| `openrouter_base_url`| Base URL for Openrouter API | Openrouter |
| `site_url` | Site URL | Openrouter |
| `app_name` | Application name | Openrouter |
| `ollama_base_url` | Base URL for Ollama API | Ollama |
| `openai_base_url` | Base URL for OpenAI API | OpenAI |
| `azure_kwargs` | Azure LLM args for initialization | AzureOpenAI |
## Supported LLMs
For detailed information on configuring specific llms, please visit the [LLMs](./models) section. There you'll find information for each supported llm with provider-specific usage examples and configuration details.
+29
View File
@@ -0,0 +1,29 @@
To use anthropic's models, please set the `ANTHROPIC_API_KEY` which you find on their [Account Settings Page](https://console.anthropic.com/account/keys).
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["ANTHROPIC_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "anthropic",
"config": {
"model": "claude-3-5-sonnet-latest",
"temperature": 0.1,
"max_tokens": 2000,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `anthropic` config are present in [Master List of All Params in Config](../config).
@@ -0,0 +1,38 @@
---
title: AWS Bedrock
---
### Setup
- Before using the AWS Bedrock LLM, make sure you have the appropriate model access from [Bedrock Console](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess).
- You will also need to authenticate the `boto3` client by using a method in the [AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials)
- You will have to export `AWS_REGION`, `AWS_ACCESS_KEY`, and `AWS_SECRET_ACCESS_KEY` to set environment variables.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ['AWS_REGION'] = 'us-east-1'
os.environ["AWS_ACCESS_KEY"] = "xx"
os.environ["AWS_SECRET_ACCESS_KEY"] = "xx"
config = {
"llm": {
"provider": "aws_bedrock",
"config": {
"model": "arn:aws:bedrock:us-east-1:123456789012:model/your-model-name",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
All available parameters for the `aws_bedrock` config are present in [Master List of All Params in Config](../config).
@@ -0,0 +1,76 @@
---
title: Azure OpenAI
---
To use Azure OpenAI models, you have to set the `LLM_AZURE_OPENAI_API_KEY`, `LLM_AZURE_ENDPOINT`, `LLM_AZURE_DEPLOYMENT` and `LLM_AZURE_API_VERSION` environment variables. You can obtain the Azure API key from the [Azure](https://azure.microsoft.com/).
## Usage
```python
import os
from mem0 import Memory
os.environ["LLM_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["LLM_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["LLM_AZURE_ENDPOINT"] = "your-api-base-url"
os.environ["LLM_AZURE_API_VERSION"] = "version-to-use"
config = {
"llm": {
"provider": "azure_openai",
"config": {
"model": "your-deployment-name",
"temperature": 0.1,
"max_tokens": 2000,
"azure_kwargs": {
"azure_deployment": "",
"api_version": "",
"azure_endpoint": "",
"api_key": "",
"default_headers": {
"CustomHeader": "your-custom-header",
}
}
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
We also support the new [OpenAI structured-outputs](https://platform.openai.com/docs/guides/structured-outputs/introduction) model.
```python
import os
from mem0 import Memory
os.environ["LLM_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["LLM_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["LLM_AZURE_ENDPOINT"] = "your-api-base-url"
os.environ["LLM_AZURE_API_VERSION"] = "version-to-use"
config = {
"llm": {
"provider": "azure_openai_structured",
"config": {
"model": "your-deployment-name",
"temperature": 0.1,
"max_tokens": 2000,
"azure_kwargs": {
"azure_deployment": "",
"api_version": "",
"azure_endpoint": "",
"api_key": "",
"default_headers": {
"CustomHeader": "your-custom-header",
}
}
}
}
}
```
## Config
All available parameters for the `azure_openai` config are present in [Master List of All Params in Config](../config).
+33
View File
@@ -0,0 +1,33 @@
---
title: Gemini
---
To use Gemini model, you have to set the `GEMINI_API_KEY` environment variable. You can obtain the Gemini API key from the [Google AI Studio](https://aistudio.google.com/app/apikey)
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["GEMINI_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "gemini",
"config": {
"model": "gemini-1.5-flash-latest",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `Gemini` config are present in [Master List of All Params in Config](../config).
+33
View File
@@ -0,0 +1,33 @@
---
title: Google AI
---
To use Google AI model, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["GEMINI_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "litellm",
"config": {
"model": "gemini/gemini-pro",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `litellm` config are present in [Master List of All Params in Config](../config).
+31
View File
@@ -0,0 +1,31 @@
[Groq](https://groq.com/) is the creator of the world's first Language Processing Unit (LPU), providing exceptional speed performance for AI workloads running on their LPU Inference Engine.
In order to use LLMs from Groq, go to their [platform](https://console.groq.com/keys) and get the API key. Set the API key as `GROQ_API_KEY` environment variable to use the model as given below in the example.
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["GROQ_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "groq",
"config": {
"model": "mixtral-8x7b-32768",
"temperature": 0.1,
"max_tokens": 1000,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `groq` config are present in [Master List of All Params in Config](../config).
+28
View File
@@ -0,0 +1,28 @@
[Litellm](https://litellm.vercel.app/docs/) is compatible with over 100 large language models (LLMs), all using a standardized input/output format. You can explore the [available models](https://litellm.vercel.app/docs/providers) to use with Litellm. Ensure you set the `API_KEY` for the model you choose to use.
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "litellm",
"config": {
"model": "gpt-4o-mini",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `litellm` config are present in [Master List of All Params in Config](../config).
@@ -0,0 +1,33 @@
---
title: Mistral AI
---
To use mistral's models, please Obtain the Mistral AI api key from their [console](https://console.mistral.ai/). Set the `MISTRAL_API_KEY` environment variable to use the model as given below in the example.
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["MISTRAL_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "litellm",
"config": {
"model": "open-mixtral-8x7b",
"temperature": 0.1,
"max_tokens": 2000,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `litellm` config are present in [Master List of All Params in Config](../config).
+28
View File
@@ -0,0 +1,28 @@
You can use LLMs from Ollama to run Mem0 locally. These [models](https://ollama.com/search?c=tools) support tool support.
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # for embedder
config = {
"llm": {
"provider": "ollama",
"config": {
"model": "mixtral:8x7b",
"temperature": 0.1,
"max_tokens": 2000,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `ollama` config are present in [Master List of All Params in Config](../config).
+66
View File
@@ -0,0 +1,66 @@
---
title: OpenAI
---
To use OpenAI LLM models, you have to set the `OPENAI_API_KEY` environment variable. You can obtain the OpenAI API key from the [OpenAI Platform](https://platform.openai.com/account/api-keys).
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "openai",
"config": {
"model": "gpt-4o",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
# Use Openrouter by passing it's api key
# os.environ["OPENROUTER_API_KEY"] = "your-api-key"
# config = {
# "llm": {
# "provider": "openai",
# "config": {
# "model": "meta-llama/llama-3.1-70b-instruct",
# }
# }
# }
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
We also support the new [OpenAI structured-outputs](https://platform.openai.com/docs/guides/structured-outputs/introduction) model.
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "openai_structured",
"config": {
"model": "gpt-4o-2024-08-06",
"temperature": 0.0,
}
}
}
m = Memory.from_config(config)
```
## Config
All available parameters for the `openai` config are present in [Master List of All Params in Config](../config).
+29
View File
@@ -0,0 +1,29 @@
To use TogetherAI LLM models, you have to set the `TOGETHER_API_KEY` environment variable. You can obtain the TogetherAI API key from their [Account settings page](https://api.together.xyz/settings/api-keys).
## Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["TOGETHER_API_KEY"] = "your-api-key"
config = {
"llm": {
"provider": "together",
"config": {
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
"temperature": 0.2,
"max_tokens": 1500,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Config
All available parameters for the `togetherai` config are present in [Master List of All Params in Config](../config).
+51
View File
@@ -0,0 +1,51 @@
---
title: Overview
---
Mem0 includes built-in support for various popular large language models. Memory can utilize the LLM provided by the user, ensuring efficient use for specific needs.
## Usage
To use a llm, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and `OpenAI` will be used as the llm.
For a comprehensive list of available parameters for llm configuration, please refer to [Config](./config).
To view all supported llms, visit the [Supported LLMs](./models).
<CardGroup cols={4}>
<Card title="OpenAI" href="/components/llms/models/openai"></Card>
<Card title="Ollama" href="/components/llms/models/ollama"></Card>
<Card title="Azure OpenAI" href="/components/llms/models/azure_openai"></Card>
<Card title="Anthropic" href="/components/llms/models/anthropic"></Card>
<Card title="Together" href="/components/llms/models/together"></Card>
<Card title="Groq" href="/components/llms/models/groq"></Card>
<Card title="Litellm" href="/components/llms/models/litellm"></Card>
<Card title="Mistral AI" href="/components/llms/models/mistral_ai"></Card>
<Card title="Google AI" href="/components/llms/models/google_ai"></Card>
<Card title="AWS bedrock" href="/components/llms/models/aws_bedrock"></Card>
<Card title="Gemini" href="/components/llms/models/gemini"></Card>
</CardGroup>
## Structured vs Unstructured Outputs
Mem0 supports two types of OpenAI LLM formats, each with its own strengths and use cases:
### Structured Outputs
Structured outputs are LLMs that align with OpenAI's structured outputs model:
- **Optimized for:** Returning structured responses (e.g., JSON objects)
- **Benefits:** Precise, easily parseable data
- **Ideal for:** Data extraction, form filling, API responses
- **Learn more:** [OpenAI Structured Outputs Guide](https://platform.openai.com/docs/guides/structured-outputs/introduction)
### Unstructured Outputs
Unstructured outputs correspond to OpenAI's standard, free-form text model:
- **Flexibility:** Returns open-ended, natural language responses
- **Customization:** Use the `response_format` parameter to guide output
- **Trade-off:** Less efficient than structured outputs for specific data needs
- **Best for:** Creative writing, explanations, general conversation
Choose the format that best suits your application's requirements for optimal performance and usability.
+72
View File
@@ -0,0 +1,72 @@
## What is Config?
Config in mem0 is a dictionary that specifies the settings for your vector database. It allows you to customize the behavior and connection details of your chosen vector store.
## How to Define Config
The config is defined as a Python dictionary with two main keys:
- `vector_store`: Specifies the vector database provider and its configuration
- `provider`: The name of the vector database (e.g., "chroma", "pgvector", "qdrant", "milvus","azure_ai_search")
- `config`: A nested dictionary containing provider-specific settings
## How to Use Config
Here's a general example of how to use the config with mem0:
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "your_chosen_provider",
"config": {
# Provider-specific settings go here
}
}
}
m = Memory.from_config(config)
m.add("Your text here", user_id="user", metadata={"category": "example"})
```
## Why is Config Needed?
Config is essential for:
1. Specifying which vector database to use.
2. Providing necessary connection details (e.g., host, port, credentials).
3. Customizing database-specific settings (e.g., collection name, path).
4. Ensuring proper initialization and connection to your chosen vector store.
## Master List of All Params in Config
Here's a comprehensive list of all parameters that can be used across different vector databases:
| Parameter | Description |
|-----------|-------------|
| `collection_name` | Name of the collection |
| `embedding_model_dims` | Dimensions of the embedding model |
| `client` | Custom client for the database |
| `path` | Path for the database |
| `host` | Host where the server is running |
| `port` | Port where the server is running |
| `user` | Username for database connection |
| `password` | Password for database connection |
| `dbname` | Name of the database |
| `url` | Full URL for the server |
| `api_key` | API key for the server |
| `on_disk` | Enable persistent storage |
## Customizing Config
Each vector database has its own specific configuration requirements. To customize the config for your chosen vector store:
1. Identify the vector database you want to use from [supported vector databases](./dbs).
2. Refer to the `Config` section in the respective vector database's documentation.
3. Include only the relevant parameters for your chosen database in the `config` dictionary.
## Supported Vector Databases
For detailed information on configuring specific vector databases, please visit the [Supported Vector Databases](./dbs) section. There you'll find individual pages for each supported vector store with provider-specific usage examples and configuration details.
@@ -0,0 +1,38 @@
[Azure AI Search](https://learn.microsoft.com/en-us/azure/search/search-what-is-azure-search/) (formerly known as "Azure Cognitive Search") provides secure information retrieval at scale over user-owned content in traditional and generative AI search applications.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx" #this key is used for embedding purpose
config = {
"vector_store": {
"provider": "azure_ai_search",
"config": {
"service_name": "ai-search-test",
"api_key": "*****",
"collection_name": "mem0",
"embedding_model_dims": 1536 ,
"use_compression": False
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Let's see the available parameters for the `qdrant` config:
service_name (str): Azure Cognitive Search service name.
| Parameter | Description | Default Value |
| --- | --- | --- |
| `service_name` | Azure AI Search service name | `None` |
| `api_key` | API key of the Azure AI Search service | `None` |
| `collection_name` | The name of the collection/index to store the vectors, it will be created automatically if not exist | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `use_compression` | Use scalar quantization vector compression | False |
+35
View File
@@ -0,0 +1,35 @@
[Chroma](https://www.trychroma.com/) is an AI-native open-source vector database that simplifies building LLM apps by providing tools for storing, embedding, and searching embeddings with a focus on simplicity and speed.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "chroma",
"config": {
"collection_name": "test",
"path": "db",
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Here are the parameters available for configuring Chroma:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `collection_name` | The name of the collection | `mem0` |
| `client` | Custom client for Chroma | `None` |
| `path` | Path for the Chroma database | `db` |
| `host` | The host where the Chroma server is running | `None` |
| `port` | The port where the Chroma server is running | `None` |
@@ -0,0 +1,58 @@
[Elasticsearch](https://www.elastic.co/) is a distributed, RESTful search and analytics engine that can efficiently store and search vector data using dense vectors and k-NN search.
### Installation
Elasticsearch support requires additional dependencies. Install them with:
```bash
pip install elasticsearch>=8.0.0
```
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "elasticsearch",
"config": {
"collection_name": "mem0",
"host": "localhost",
"port": 9200,
"embedding_model_dims": 1536
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Let's see the available parameters for the `elasticsearch` config:
| Parameter | Description | Default Value |
| ---------------------- | -------------------------------------------------- | ------------- |
| `collection_name` | The name of the index to store the vectors | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `host` | The host where the Elasticsearch server is running | `localhost` |
| `port` | The port where the Elasticsearch server is running | `9200` |
| `cloud_id` | Cloud ID for Elastic Cloud deployment | `None` |
| `api_key` | API key for authentication | `None` |
| `user` | Username for basic authentication | `None` |
| `password` | Password for basic authentication | `None` |
| `verify_certs` | Whether to verify SSL certificates | `True` |
| `auto_create_index` | Whether to automatically create the index | `True` |
### Features
- Efficient vector search using Elasticsearch's native k-NN search
- Support for both local and cloud deployments (Elastic Cloud)
- Multiple authentication methods (Basic Auth, API Key)
- Automatic index creation with optimized mappings for vector search
- Memory isolation through payload filtering
+35
View File
@@ -0,0 +1,35 @@
[Milvus](https://milvus.io/) Milvus is an open-source vector database that suits AI applications of every size from running a demo chatbot in Jupyter notebook to building web-scale search that serves billions of users.
### Usage
```python
import os
from mem0 import Memory
config = {
"vector_store": {
"provider": "milvus",
"config": {
"collection_name": "test",
"embedding_model_dims": "123",
"url": "127.0.0.1",
"token": "8e4b8ca8cf2c67",
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Here's the parameters available for configuring Milvus Database:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `url` | Full URL/Uri for Milvus/Zilliz server | `http://localhost:19530` |
| `token` | Token for Zilliz server / for local setup defaults to None. | `None` |
| `collection_name` | The name of the collection | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `metric_type` | Metric type for similarity search | `L2` |
@@ -0,0 +1,41 @@
[pgvector](https://github.com/pgvector/pgvector) is open-source vector similarity search for Postgres. After connecting with postgres run `CREATE EXTENSION IF NOT EXISTS vector;` to create the vector extension.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "pgvector",
"config": {
"user": "test",
"password": "123",
"host": "127.0.0.1",
"port": "5432",
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Here's the parameters available for configuring pgvector:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `dbname` | The name of the | `postgres` |
| `collection_name` | The name of the collection | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `user` | User name to connect to the database | `None` |
| `password` | Password to connect to the database | `None` |
| `host` | The host where the Postgres server is running | `None` |
| `port` | The port where the Postgres server is running | `None` |
| `diskann` | Whether to use diskann for vector similarity search (requires pgvectorscale) | `True` |
| `hnsw` | Whether to use hnsw for vector similarity search | `False` |
+40
View File
@@ -0,0 +1,40 @@
[Qdrant](https://qdrant.tech/) is an open-source vector search engine. It is designed to work with large-scale datasets and provides a high-performance search engine for vector data.
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"collection_name": "test",
"host": "localhost",
"port": 6333,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Let's see the available parameters for the `qdrant` config:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `collection_name` | The name of the collection to store the vectors | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `client` | Custom client for qdrant | `None` |
| `host` | The host where the qdrant server is running | `None` |
| `port` | The port where the qdrant server is running | `None` |
| `path` | Path for the qdrant database | `/tmp/qdrant` |
| `url` | Full URL for the qdrant server | `None` |
| `api_key` | API key for the qdrant server | `None` |
| `on_disk` | For enabling persistent storage | `False` |
+44
View File
@@ -0,0 +1,44 @@
[Redis](https://redis.io/) is a scalable, real-time database that can store, search, and analyze vector data.
### Installation
```bash
pip install redis redisvl
```
Redis Stack using Docker:
```bash
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
```
### Usage
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "sk-xx"
config = {
"vector_store": {
"provider": "redis",
"config": {
"collection_name": "mem0",
"embedding_model_dims": 1536,
"redis_url": "redis://localhost:6379"
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
### Config
Let's see the available parameters for the `redis` config:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `collection_name` | The name of the collection to store the vectors | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `redis_url` | The URL of the Redis server | `None` |
+37
View File
@@ -0,0 +1,37 @@
---
title: Overview
---
Mem0 includes built-in support for various popular databases. Memory can utilize the database provided by the user, ensuring efficient use for specific needs.
## Supported Vector Databases
See the list of supported vector databases below.
<CardGroup cols={3}>
<Card title="Qdrant" href="/components/vectordbs/dbs/qdrant"></Card>
<Card title="Chroma" href="/components/vectordbs/dbs/chroma"></Card>
<Card title="Pgvector" href="/components/vectordbs/dbs/pgvector"></Card>
<Card title="Milvus" href="/components/vectordbs/dbs/milvus"></Card>
<Card title="Azure AI Search" href="/components/vectordbs/dbs/azure_ai_search"></Card>
<Card title="Redis" href="/components/vectordbs/dbs/redis"></Card>
<Card title="Elasticsearch" href="/components/vectordbs/dbs/elasticsearch"></Card>
</CardGroup>
## Usage
To utilize a vector database, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and `Qdrant` will be used as the vector database.
For a comprehensive list of available parameters for vector database configuration, please refer to [Config](./config).
## Common issues
### Using model with different dimensions
If you are using customized model, which is having different dimensions other than 1536
for example 768, you may encounter below error:
`ValueError: shapes (0,1536) and (768,) not aligned: 1536 (dim 1) != 768 (dim 0)`
you could add `"embedding_model_dims": 768,` to the config of the vector_store to overcome this issue.
-4
View File
@@ -1,4 +0,0 @@
---
title: '📋 Guidelines'
url: https://github.com/embedchain/embedchain/blob/main/CONTRIBUTING.md
---
-4
View File
@@ -1,4 +0,0 @@
---
title: ' 🟨 Javascript'
url: https://github.com/embedchain/embedchain/tree/main/embedchain-js
---
-17
View File
@@ -1,17 +0,0 @@
---
title: 'Embedchain.ai'
description: 'Deploy your RAG application to embedchain.ai platform'
---
## Deploy on Embedchain Platform
Embedchain enables developers to deploy their LLM-powered apps in production using the Embedchain platform. The platform offers free access to context on your data through its REST API. Once the pipeline is deployed, you can update your data sources anytime after deployment.
Deployment to Embedchain Platform is currently available on an invitation-only basis. To request access, please submit your information via the provided [Google Form](https://forms.gle/vigN11h7b4Ywat668). We will review your request and respond promptly.
## Seeking help?
If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
<Snippet file="get-help.mdx" />
+166
View File
@@ -0,0 +1,166 @@
---
title: AI Companion
---
You can create a personalised AI Companion using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
The Personalized AI Companion leverages Mem0 to retain information across interactions, enabling a tailored learning experience. It creates separate memories for both the user and the companion. By integrating with OpenAI's GPT-4 model, the companion can provide detailed and context-aware responses to user queries.
## Setup
Before you begin, ensure you have the required dependencies installed. You can install the necessary packages using pip:
```bash
pip install openai mem0ai
```
## Full Code Example
Below is the complete code to create and interact with an AI Companion using Mem0:
```python
from openai import OpenAI
from mem0 import Memory
import os
# Set the OpenAI API key
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
# Initialize the OpenAI client
client = OpenAI()
class Companion:
def __init__(self, user_id, companion_id):
"""
Initialize the Companion with memory configuration, OpenAI client, and user IDs.
:param user_id: ID for storing user-related memories
:param companion_id: ID for storing companion-related memories
"""
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"host": "localhost",
"port": 6333,
}
},
}
self.memory = Memory.from_config(config)
self.client = client
self.app_id = "app-1"
self.USER_ID = user_id
self.companion_id = companion_id
def analyze_question(self, question):
"""
Analyze the question to determine whether it's about the user or the companion.
"""
check_prompt = f"""
Analyze the given input and determine whether the user is primarily:
1) Talking about themselves or asking for personal advice. They may use words like "I" for this.
2) Inquiring about the AI companions's capabilities or characteristics They may use words like "you" for this.
Respond with a single word:
- 'user' if the input is focused on the user
- 'companion' if the input is focused on the AI companion
If the input is ambiguous or doesn't clearly fit either category, respond with 'user'.
Input: {question}
"""
response = self.client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": check_prompt}]
)
return response.choices[0].message.content
def ask(self, question):
"""
Ask a question to the AI and store the relevant facts in memory
:param question: The question to ask the AI.
"""
check_answer = self.analyze_question(question)
user_id_to_use = self.USER_ID if check_answer == "user" else self.companion_id
previous_memories = self.memory.search(question, user_id=user_id_to_use)
relevant_memories_text = ""
if previous_memories:
relevant_memories_text = '\n'.join(mem["memory"] for mem in previous_memories)
prompt = f"User input: {question}\nPrevious {check_answer} memories: {relevant_memories_text}"
messages = [
{
"role": "system",
"content": "You are the user's romantic companion. Use the user's input and previous memories to respond. Answer based on the context provided."
},
{
"role": "user",
"content": prompt
}
]
stream = self.client.chat.completions.create(
model="gpt-4",
stream=True,
messages=messages
)
answer = ""
for chunk in stream:
if chunk.choices[0].delta.content is not None:
content = chunk.choices[0].delta.content
print(content, end="")
answer += content
# Store the question and answer in memory
self.memory.add(question, user_id=self.USER_ID, metadata={"app_id": self.app_id})
self.memory.add(answer, user_id=self.companion_id, metadata={"app_id": self.app_id})
def get_memories(self, user_id=None):
"""
Retrieve all memories associated with the given user ID.
:param user_id: Optional user ID to filter memories.
:return: List of memories.
"""
return self.memory.get_all(user_id=user_id)
# Example usage:
user_id = "user"
companion_id = "companion"
ai_companion = Companion(user_id, companion_id)
# Ask a question
ai_companion.ask("Ive been missing you. What have you been up to off late?")
```
### Fetching Memories
You can fetch all the memories at any point in time using the following code:
```python
def print_memories(user_id, label):
print(f"\n{label} Memories:")
memories = ai_companion.get_memories(user_id=user_id)
if memories:
for m in memories:
print(f"- {m['text']}")
else:
print("No memories found.")
# Print user memories
print_memories(user_id, "User")
# Print companion memories
print_memories(companion_id, "Companion")
```
### Key Points
- **Initialization**: The Companion class is initialized with the necessary memory configuration and OpenAI client setup.
- **Asking Questions**: The ask method sends a question to the AI and stores the relevant information in memory.
- **Retrieving Memories**: The get_memories method fetches all stored memories associated with a user.
### Conclusion
As the conversation progresses, Mem0's memory automatically updates based on the interactions, providing a continuously improving personalized experience. This setup ensures that the AI Companion can offer contextually relevant and accurate responses, enhancing the user's experience.
+109
View File
@@ -0,0 +1,109 @@
---
title: Customer Support AI Agent
---
You can create a personalized Customer Support AI Agent using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
The Customer Support AI Agent leverages Mem0 to retain information across interactions, enabling a personalized and efficient support experience.
## Setup
Install the necessary packages using pip:
```bash
pip install openai mem0ai
```
## Full Code Example
Below is the simplified code to create and interact with a Customer Support AI Agent using Mem0:
```python
from openai import OpenAI
from mem0 import Memory
# Set the OpenAI API key
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
class CustomerSupportAIAgent:
def __init__(self):
"""
Initialize the CustomerSupportAIAgent with memory configuration and OpenAI client.
"""
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"host": "localhost",
"port": 6333,
}
},
}
self.memory = Memory.from_config(config)
self.client = OpenAI()
self.app_id = "customer-support"
def handle_query(self, query, user_id=None):
"""
Handle a customer query and store the relevant information in memory.
:param query: The customer query to handle.
:param user_id: Optional user ID to associate with the memory.
"""
# Start a streaming chat completion request to the AI
stream = self.client.chat.completions.create(
model="gpt-4",
stream=True,
messages=[
{"role": "system", "content": "You are a customer support AI agent."},
{"role": "user", "content": query}
]
)
# Store the query in memory
self.memory.add(query, user_id=user_id, metadata={"app_id": self.app_id})
# Print the response from the AI in real-time
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
def get_memories(self, user_id=None):
"""
Retrieve all memories associated with the given customer ID.
:param user_id: Optional user ID to filter memories.
:return: List of memories.
"""
return self.memory.get_all(user_id=user_id)
# Instantiate the CustomerSupportAIAgent
support_agent = CustomerSupportAIAgent()
# Define a customer ID
customer_id = "jane_doe"
# Handle a customer query
support_agent.handle_query("I need help with my recent order. It hasn't arrived yet.", user_id=customer_id)
```
### Fetching Memories
You can fetch all the memories at any point in time using the following code:
```python
memories = support_agent.get_memories(user_id=customer_id)
for m in memories:
print(m['text'])
```
### Key Points
- **Initialization**: The CustomerSupportAIAgent class is initialized with the necessary memory configuration and OpenAI client setup.
- **Handling Queries**: The handle_query method sends a query to the AI and stores the relevant information in memory.
- **Retrieving Memories**: The get_memories method fetches all stored memories associated with a customer.
### Conclusion
As the conversation progresses, Mem0's memory automatically updates based on the interactions, providing a continuously improving personalized support experience.
+172
View File
@@ -0,0 +1,172 @@
---
title: LlamaIndex ReAct Agent
---
Create a ReAct Agent with LlamaIndex which uses Mem0 as the memory store.
### Overview
A ReAct agent combines reasoning and action capabilities, making it versatile for tasks requiring both thought processes (reasoning) and interaction with tools or APIs (acting). Mem0 as memory enhances these capabilities by allowing the agent to store and retrieve contextual information from past interactions.
### Setup
```bash
pip install llama-index-core llama-index-memory-mem0
```
Initialize the LLM.
```python
import os
from llama_index.llms.openai import OpenAI
os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>"
llm = OpenAI(model="gpt-4o")
```
Initialize the Mem0 client. You can find your API key [here](https://app.mem0.ai/dashboard/). Read about Mem0 [Open Source](https://docs.mem0.ai/open-source/quickstart).
```python
os.environ["MEM0_API_KEY"] = "<your-mem0-api-key>"
from llama_index.memory.mem0 import Mem0Memory
context = {"user_id": "david"}
memory_from_client = Mem0Memory.from_client(
context=context,
api_key=os.environ["MEM0_API_KEY"],
search_msg_limit=4, # optional, default is 5
)
```
Create the tools. These tools will be used by the agent to perform actions.
```python
from llama_index.core.tools import FunctionTool
def call_fn(name: str):
"""Call the provided name.
Args:
name: str (Name of the person)
"""
return f"Calling... {name}"
def email_fn(name: str):
"""Email the provided name.
Args:
name: str (Name of the person)
"""
return f"Emailing... {name}"
def order_food(name: str, dish: str):
"""Order food for the provided name.
Args:
name: str (Name of the person)
dish: str (Name of the dish)
"""
return f"Ordering {dish} for {name}"
call_tool = FunctionTool.from_defaults(fn=call_fn)
email_tool = FunctionTool.from_defaults(fn=email_fn)
order_food_tool = FunctionTool.from_defaults(fn=order_food)
```
Initialize the agent with tools and memory.
```python
from llama_index.core.agent import FunctionCallingAgent
agent = FunctionCallingAgent.from_tools(
[call_tool, email_tool, order_food_tool],
llm=llm,
memory=memory_from_client, # or memory_from_config
verbose=True,
)
```
Start the chat.
<Note> The agent will use the Mem0 to store the relavant memories from the chat. </Note>
Input
```python
response = agent.chat("Hi, My name is David")
print(response)
```
Output
```text
> Running step bf44a75a-a920-4cf3-944e-b6e6b5695043. Step input: Hi, My name is David
Added user message to memory: Hi, My name is David
=== LLM Response ===
Hello, David! How can I assist you today?
```
Input
```python
response = agent.chat("I love to eat pizza on weekends")
print(response)
```
Output
```text
> Running step 845783b0-b85b-487c-baee-8460ebe8b38d. Step input: I love to eat pizza on weekends
Added user message to memory: I love to eat pizza on weekends
=== LLM Response ===
Pizza is a great choice for the weekend! If you'd like, I can help you order some. Just let me know what kind of pizza you prefer!
```
Input
```python
response = agent.chat("My preferred way of communication is email")
print(response)
```
Output
```text
> Running step 345842f0-f8a0-42ea-a1b7-612265d72a92. Step input: My preferred way of communication is email
Added user message to memory: My preferred way of communication is email
=== LLM Response ===
Got it! If you need any assistance or have any requests, feel free to let me know, and I can communicate with you via email.
```
### Using the agent WITHOUT memory
Input
```python
agent = FunctionCallingAgent.from_tools(
[call_tool, email_tool, order_food_tool],
# memory is not provided
llm=llm,
verbose=True,
)
response = agent.chat("I am feeling hungry, order me something and send me the bill")
print(response)
```
Output
```text
> Running step e89eb75d-75e1-4dea-a8c8-5c3d4b77882d. Step input: I am feeling hungry, order me something and send me the bill
Added user message to memory: I am feeling hungry, order me something and send me the bill
=== LLM Response ===
Please let me know your name and the dish you'd like to order, and I'll take care of it for you!
```
<Note> The agent is not able to remember the past prefernces that user shared in previous chats. </Note>
### Using the agent WITH memory
Input
```python
agent = FunctionCallingAgent.from_tools(
[call_tool, email_tool, order_food_tool],
llm=llm,
# memory is provided
memory=memory_from_client, # or memory_from_config
verbose=True,
)
response = agent.chat("I am feeling hungry, order me something and send me the bill")
print(response)
```
Output
```text
> Running step 5e473db9-3973-4cb1-a5fd-860be0ab0006. Step input: I am feeling hungry, order me something and send me the bill
Added user message to memory: I am feeling hungry, order me something and send me the bill
=== Calling Function ===
Calling function: order_food with args: {"name": "David", "dish": "pizza"}
=== Function Output ===
Ordering pizza for David
=== Calling Function ===
Calling function: email_fn with args: {"name": "David"}
=== Function Output ===
Emailing... David
> Running step 38080544-6b37-4bb2-aab2-7670100d926e. Step input: None
=== LLM Response ===
I've ordered a pizza for you, and the bill has been sent to your email. Enjoy your meal! If there's anything else you need, feel free to let me know.
```
<Note> The agent is able to remember the past prefernces that user shared and use them to perform actions. </Note>
+73
View File
@@ -0,0 +1,73 @@
---
title: Mem0 with Ollama
---
## Running Mem0 Locally with Ollama
Mem0 can be utilized entirely locally by leveraging Ollama for both the embedding model and the language model (LLM). This guide will walk you through the necessary steps and provide the complete code to get you started.
### Overview
By using Ollama, you can run Mem0 locally, which allows for greater control over your data and models. This setup uses Ollama for both the embedding model and the language model, providing a fully local solution.
### Setup
Before you begin, ensure you have Mem0 and Ollama installed and properly configured on your local machine.
### Full Code Example
Below is the complete code to set up and use Mem0 locally with Ollama:
```python
import os
from mem0 import Memory
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"collection_name": "test",
"host": "localhost",
"port": 6333,
"embedding_model_dims": 768, # Change this according to your local model's dimensions
},
},
"llm": {
"provider": "ollama",
"config": {
"model": "llama3.1:latest",
"temperature": 0,
"max_tokens": 8000,
"ollama_base_url": "http://localhost:11434", # Ensure this URL is correct
},
},
"embedder": {
"provider": "ollama",
"config": {
"model": "nomic-embed-text:latest",
# Alternatively, you can use "snowflake-arctic-embed:latest"
"ollama_base_url": "http://localhost:11434",
},
},
}
# Initialize Memory with the configuration
m = Memory.from_config(config)
# Add a memory
m.add("I'm visiting Paris", user_id="john")
# Retrieve memories
memories = m.get_all(user_id="john")
```
### Key Points
- **Configuration**: The setup involves configuring the vector store, language model, and embedding model to use local resources.
- **Vector Store**: Qdrant is used as the vector store, running on localhost.
- **Language Model**: Ollama is used as the LLM provider, with the "llama3.1:latest" model.
- **Embedding Model**: Ollama is also used for embeddings, with the "nomic-embed-text:latest" model.
### Conclusion
This local setup of Mem0 using Ollama provides a fully self-contained solution for memory management and AI interactions. It allows for greater control over your data and models while still leveraging the powerful capabilities of Mem0.
+35
View File
@@ -0,0 +1,35 @@
---
title: Overview
description: How to use mem0 in your existing applications?
---
With Mem0, you can create stateful LLM-based applications such as chatbots, virtual assistants, or AI agents. Mem0 enhances your applications by providing a memory layer that makes responses:
- More personalized
- More reliable
- Cost-effective by reducing the number of LLM interactions
- More engaging
- Enables long-term memory
Here are some examples of how Mem0 can be integrated into various applications:
## Examples
<CardGroup cols={2}>
<Card title="Mem0 with Ollama" icon="square-1" href="/examples/mem0-with-ollama">
Run Mem0 locally with Ollama.
</Card>
<Card title="Personal AI Tutor" icon="square-2" href="/examples/personal-ai-tutor">
Create a Personalized AI Tutor that adapts to student progress and learning preferences.
</Card>
<Card title="Personal Travel Assistant" icon="square-3" href="/examples/personal-travel-assistant">
Build a Personalized AI Travel Assistant that understands your travel preferences and past itineraries.
</Card>
<Card title="Customer Support Agent" icon="square-4" href="/examples/customer-support-agent">
Develop a Personal AI Assistant that remembers user preferences, past interactions, and context to provide personalized and efficient assistance.
</Card>
<Card title="LlamaIndex Mem0" icon="square-5" href="/examples/llama-index-mem0">
Create a ReAct Agent with LlamaIndex which uses Mem0 as the memory store.
</Card>
</CardGroup>
+111
View File
@@ -0,0 +1,111 @@
---
title: Personalized AI Tutor
---
You can create a personalized AI Tutor using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
The Personalized AI Tutor leverages Mem0 to retain information across interactions, enabling a tailored learning experience. By integrating with OpenAI's GPT-4 model, the tutor can provide detailed and context-aware responses to user queries.
## Setup
Before you begin, ensure you have the required dependencies installed. You can install the necessary packages using pip:
```bash
pip install openai mem0ai
```
## Full Code Example
Below is the complete code to create and interact with a Personalized AI Tutor using Mem0:
```python
from openai import OpenAI
from mem0 import Memory
# Set the OpenAI API key
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
# Initialize the OpenAI client
client = OpenAI()
class PersonalAITutor:
def __init__(self):
"""
Initialize the PersonalAITutor with memory configuration and OpenAI client.
"""
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"host": "localhost",
"port": 6333,
}
},
}
self.memory = Memory.from_config(config)
self.client = client
self.app_id = "app-1"
def ask(self, question, user_id=None):
"""
Ask a question to the AI and store the relevant facts in memory
:param question: The question to ask the AI.
:param user_id: Optional user ID to associate with the memory.
"""
# Start a streaming chat completion request to the AI
stream = self.client.chat.completions.create(
model="gpt-4",
stream=True,
messages=[
{"role": "system", "content": "You are a personal AI Tutor."},
{"role": "user", "content": question}
]
)
# Store the question in memory
self.memory.add(question, user_id=user_id, metadata={"app_id": self.app_id})
# Print the response from the AI in real-time
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
def get_memories(self, user_id=None):
"""
Retrieve all memories associated with the given user ID.
:param user_id: Optional user ID to filter memories.
:return: List of memories.
"""
return self.memory.get_all(user_id=user_id)
# Instantiate the PersonalAITutor
ai_tutor = PersonalAITutor()
# Define a user ID
user_id = "john_doe"
# Ask a question
ai_tutor.ask("I am learning introduction to CS. What is queue? Briefly explain.", user_id=user_id)
```
### Fetching Memories
You can fetch all the memories at any point in time using the following code:
```python
memories = ai_tutor.get_memories(user_id=user_id)
for m in memories:
print(m['text'])
```
### Key Points
- **Initialization**: The PersonalAITutor class is initialized with the necessary memory configuration and OpenAI client setup.
- **Asking Questions**: The ask method sends a question to the AI and stores the relevant information in memory.
- **Retrieving Memories**: The get_memories method fetches all stored memories associated with a user.
### Conclusion
As the conversation progresses, Mem0's memory automatically updates based on the interactions, providing a continuously improving personalized learning experience. This setup ensures that the AI Tutor can offer contextually relevant and accurate responses, enhancing the overall educational process.
+195
View File
@@ -0,0 +1,195 @@
---
title: Personal AI Travel Assistant
---
Create a personalized AI Travel Assistant using Mem0. This guide provides step-by-step instructions and the complete code to get you started.
## Overview
The Personalized AI Travel Assistant uses Mem0 to store and retrieve information across interactions, enabling a tailored travel planning experience. It integrates with OpenAI's GPT-4 model to provide detailed and context-aware responses to user queries.
## Setup
Install the required dependencies using pip:
```bash
pip install openai mem0ai
```
## Full Code Example
Here's the complete code to create and interact with a Personalized AI Travel Assistant using Mem0:
<CodeGroup>
```python After v1.1
import os
from openai import OpenAI
from mem0 import Memory
# Set the OpenAI API key
os.environ['OPENAI_API_KEY'] = "sk-xxx"
config = {
"llm": {
"provider": "openai",
"config": {
"model": "gpt-4o",
"temperature": 0.1,
"max_tokens": 2000,
}
},
"embedder": {
"provider": "openai",
"config": {
"model": "text-embedding-3-large"
}
},
"vector_store": {
"provider": "qdrant",
"config": {
"collection_name": "test",
"embedding_model_dims": 3072,
}
},
"version": "v1.1",
}
class PersonalTravelAssistant:
def __init__(self):
self.client = OpenAI()
self.memory = Memory.from_config(config)
self.messages = [{"role": "system", "content": "You are a personal AI Assistant."}]
def ask_question(self, question, user_id):
# Fetch previous related memories
previous_memories = self.search_memories(question, user_id=user_id)
prompt = question
if previous_memories:
prompt = f"User input: {question}\n Previous memories: {previous_memories}"
self.messages.append({"role": "user", "content": prompt})
# Generate response using GPT-4o
response = self.client.chat.completions.create(
model="gpt-4o",
messages=self.messages
)
answer = response.choices[0].message.content
self.messages.append({"role": "assistant", "content": answer})
# Store the question in memory
self.memory.add(question, user_id=user_id)
return answer
def get_memories(self, user_id):
memories = self.memory.get_all(user_id=user_id)
return [m['memory'] for m in memories['memories']]
def search_memories(self, query, user_id):
memories = self.memory.search(query, user_id=user_id)
return [m['memory'] for m in memories['memories']]
# Usage example
user_id = "traveler_123"
ai_assistant = PersonalTravelAssistant()
def main():
while True:
question = input("Question: ")
if question.lower() in ['q', 'exit']:
print("Exiting...")
break
answer = ai_assistant.ask_question(question, user_id=user_id)
print(f"Answer: {answer}")
memories = ai_assistant.get_memories(user_id=user_id)
print("Memories:")
for memory in memories:
print(f"- {memory}")
print("-----")
if __name__ == "__main__":
main()
```
```python Before v1.1
import os
from openai import OpenAI
from mem0 import Memory
# Set the OpenAI API key
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
class PersonalTravelAssistant:
def __init__(self):
self.client = OpenAI()
self.memory = Memory()
self.messages = [{"role": "system", "content": "You are a personal AI Assistant."}]
def ask_question(self, question, user_id):
# Fetch previous related memories
previous_memories = self.search_memories(question, user_id=user_id)
prompt = question
if previous_memories:
prompt = f"User input: {question}\n Previous memories: {previous_memories}"
self.messages.append({"role": "user", "content": prompt})
# Generate response using GPT-4o
response = self.client.chat.completions.create(
model="gpt-4o",
messages=self.messages
)
answer = response.choices[0].message.content
self.messages.append({"role": "assistant", "content": answer})
# Store the question in memory
self.memory.add(question, user_id=user_id)
return answer
def get_memories(self, user_id):
memories = self.memory.get_all(user_id=user_id)
return [m['memory'] for m in memories['memories']]
def search_memories(self, query, user_id):
memories = self.memory.search(query, user_id=user_id)
return [m['memory'] for m in memories['memories']]
# Usage example
user_id = "traveler_123"
ai_assistant = PersonalTravelAssistant()
def main():
while True:
question = input("Question: ")
if question.lower() in ['q', 'exit']:
print("Exiting...")
break
answer = ai_assistant.ask_question(question, user_id=user_id)
print(f"Answer: {answer}")
memories = ai_assistant.get_memories(user_id=user_id)
print("Memories:")
for memory in memories:
print(f"- {memory}")
print("-----")
if __name__ == "__main__":
main()
```
</CodeGroup>
## Key Components
- **Initialization**: The `PersonalTravelAssistant` class is initialized with the OpenAI client and Mem0 memory setup.
- **Asking Questions**: The `ask_question` method sends a question to the AI, incorporates previous memories, and stores new information.
- **Memory Management**: The `get_memories` and search_memories methods handle retrieval and searching of stored memories.
## Usage
1. Set your OpenAI API key in the environment variable.
2. Instantiate the `PersonalTravelAssistant`.
3. Use the `main()` function to interact with the assistant in a loop.
## Conclusion
This Personalized AI Travel Assistant leverages Mem0's memory capabilities to provide context-aware responses. As you interact with it, the assistant learns and improves, offering increasingly personalized travel advice and information.
+49
View File
@@ -0,0 +1,49 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.95343 21.1394C4.89586 21.1304 2.25471 19.458 0.987296 16.2895C-0.280118 13.121 0.108924 9.16314 1.74363 5.61505C4.8012 5.62409 7.44235 7.29648 8.70976 10.465C9.97718 13.6335 9.58814 17.5914 7.95343 21.1394Z" fill="white"/>
<path d="M7.95343 21.1394C4.89586 21.1304 2.25471 19.458 0.987296 16.2895C-0.280118 13.121 0.108924 9.16314 1.74363 5.61505C4.8012 5.62409 7.44235 7.29648 8.70976 10.465C9.97718 13.6335 9.58814 17.5914 7.95343 21.1394Z" fill="url(#paint0_radial_101_2703)"/>
<path d="M7.95343 21.1394C4.89586 21.1304 2.25471 19.458 0.987296 16.2895C-0.280118 13.121 0.108924 9.16314 1.74363 5.61505C4.8012 5.62409 7.44235 7.29648 8.70976 10.465C9.97718 13.6335 9.58814 17.5914 7.95343 21.1394Z" fill="black" fill-opacity="0.5" style="mix-blend-mode:hard-light"/>
<path d="M7.95343 21.1394C4.89586 21.1304 2.25471 19.458 0.987296 16.2895C-0.280118 13.121 0.108924 9.16314 1.74363 5.61505C4.8012 5.62409 7.44235 7.29648 8.70976 10.465C9.97718 13.6335 9.58814 17.5914 7.95343 21.1394Z" fill="url(#paint1_linear_101_2703)" fill-opacity="0.5" style="mix-blend-mode:hard-light"/>
<path d="M8.68359 10.4755C9.94543 13.63 9.56145 17.5723 7.9354 21.1112C4.89702 21.0957 2.27411 19.4306 1.01347 16.279C-0.248375 13.1245 0.135612 9.18218 1.76165 5.64328C4.80004 5.65883 7.42295 7.32386 8.68359 10.4755Z" stroke="url(#paint2_linear_101_2703)" stroke-opacity="0.05" stroke-width="0.056338"/>
<path d="M7.31038 21.2574C11.3543 20.2215 14.8836 17.3754 16.6285 13.2361C18.3735 9.09671 17.9448 4.58749 15.8598 0.976291C11.8159 2.01214 8.2866 4.85826 6.54167 8.99762C4.79674 13.137 5.2254 17.6462 7.31038 21.2574Z" fill="white"/>
<path d="M7.31038 21.2574C11.3543 20.2215 14.8836 17.3754 16.6285 13.2361C18.3735 9.09671 17.9448 4.58749 15.8598 0.976291C11.8159 2.01214 8.2866 4.85826 6.54167 8.99762C4.79674 13.137 5.2254 17.6462 7.31038 21.2574Z" fill="url(#paint3_radial_101_2703)"/>
<path d="M16.6026 13.2251C14.8642 17.349 11.3512 20.1866 7.32411 21.2248C5.25257 17.624 4.82926 13.1324 6.56764 9.00855C8.30603 4.88472 11.819 2.04706 15.8461 1.00889C17.9176 4.60967 18.3409 9.10131 16.6026 13.2251Z" stroke="url(#paint4_linear_101_2703)" stroke-opacity="0.05" stroke-width="0.056338"/>
<path d="M7.23368 21.2069C9.78906 23.2373 13.2102 23.9506 16.5772 22.8141C19.9441 21.6775 22.5058 18.9445 23.7304 15.6382C21.175 13.6078 17.7538 12.8944 14.3869 14.031C11.0199 15.1676 8.45822 17.9006 7.23368 21.2069Z" fill="white"/>
<path d="M7.23368 21.2069C9.78906 23.2373 13.2102 23.9506 16.5772 22.8141C19.9441 21.6775 22.5058 18.9445 23.7304 15.6382C21.175 13.6078 17.7538 12.8944 14.3869 14.031C11.0199 15.1676 8.45822 17.9006 7.23368 21.2069Z" fill="url(#paint5_radial_101_2703)"/>
<path d="M7.23368 21.2069C9.78906 23.2373 13.2102 23.9506 16.5772 22.8141C19.9441 21.6775 22.5058 18.9445 23.7304 15.6382C21.175 13.6078 17.7538 12.8944 14.3869 14.031C11.0199 15.1676 8.45822 17.9006 7.23368 21.2069Z" fill="black" fill-opacity="0.2" style="mix-blend-mode:hard-light"/>
<path d="M7.23368 21.2069C9.78906 23.2373 13.2102 23.9506 16.5772 22.8141C19.9441 21.6775 22.5058 18.9445 23.7304 15.6382C21.175 13.6078 17.7538 12.8944 14.3869 14.031C11.0199 15.1676 8.45822 17.9006 7.23368 21.2069Z" fill="url(#paint6_linear_101_2703)" fill-opacity="0.5" style="mix-blend-mode:hard-light"/>
<path d="M16.5682 22.7874C13.2176 23.9184 9.81361 23.2124 7.2672 21.1975C8.49194 17.9068 11.0444 15.189 14.3959 14.0577C17.7465 12.9266 21.1504 13.6326 23.6968 15.6476C22.4721 18.9383 19.9196 21.656 16.5682 22.7874Z" stroke="url(#paint7_linear_101_2703)" stroke-opacity="0.05" stroke-width="0.056338"/>
<defs>
<radialGradient id="paint0_radial_101_2703" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(-3.00503 15.023) rotate(-10.029) scale(17.9572 17.784)">
<stop stop-color="#00B0BB"/>
<stop offset="1" stop-color="#00DB65"/>
</radialGradient>
<linearGradient id="paint1_linear_101_2703" x1="7.39036" y1="4.81308" x2="1.62975" y2="18.6894" gradientUnits="userSpaceOnUse">
<stop stop-color="#18E299"/>
<stop offset="1"/>
</linearGradient>
<linearGradient id="paint2_linear_101_2703" x1="7.94816" y1="8.01563" x2="1.7612" y2="18.746" gradientUnits="userSpaceOnUse">
<stop/>
<stop offset="1" stop-opacity="0"/>
</linearGradient>
<radialGradient id="paint3_radial_101_2703" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(8.11404 20.8822) rotate(-75.7542) scale(21.6246 23.7772)">
<stop stop-color="#00BBBB"/>
<stop offset="0.712616" stop-color="#00DB65"/>
</radialGradient>
<linearGradient id="paint4_linear_101_2703" x1="7.60205" y1="5.8709" x2="15.5561" y2="16.3719" gradientUnits="userSpaceOnUse">
<stop/>
<stop offset="1" stop-opacity="0"/>
</linearGradient>
<radialGradient id="paint5_radial_101_2703" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(7.84537 21.5181) rotate(-20.3525) scale(18.5603 17.32)">
<stop stop-color="#00B0BB"/>
<stop offset="1" stop-color="#00DB65"/>
</radialGradient>
<linearGradient id="paint6_linear_101_2703" x1="16.8078" y1="13.0071" x2="10.0409" y2="22.9937" gradientUnits="userSpaceOnUse">
<stop stop-color="#00B1BC"/>
<stop offset="1"/>
</linearGradient>
<linearGradient id="paint7_linear_101_2703" x1="16.8078" y1="13.0071" x2="14.1687" y2="23.841" gradientUnits="userSpaceOnUse">
<stop/>
<stop offset="1" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

+57
View File
@@ -0,0 +1,57 @@
---
title: Features
---
## Core features
- **User, Session, and AI Agent Memory**: Retains information across sessions and interactions for users and AI agents, ensuring continuity and context.
- **Adaptive Personalization**: Continuously updates memories based on user interactions and feedback.
- **Developer-Friendly API**: Offers a straightforward API for seamless integration into various applications.
- **Platform Consistency**: Ensures consistent behavior and data across different platforms and devices.
- **Managed Service**: Provides a hosted solution for easy deployment and maintenance.
- **Save Costs**: Saves costs by adding relevent memories instead of complete transcripts to context window
## How does Mem0 work?
Mem0 leverages a hybrid database approach to manage and retrieve long-term memories for AI agents and assistants. Each memory is associated with a unique identifier, such as a user ID or agent ID, allowing Mem0 to organize and access memories specific to an individual or context.
When a message is added to the Mem0 using add() method, the system extracts relevant facts and preferences and stores it across data stores: a vector database, a key-value database, and a graph database. This hybrid approach ensures that different types of information are stored in the most efficient manner, making subsequent searches quick and effective.
When an AI agent or LLM needs to recall memories, it uses the search() method. Mem0 then performs search across these data stores, retrieving relevant information from each source. This information is then passed through a scoring layer, which evaluates their importance based on relevance, importance, and recency. This ensures that only the most personalized and useful context is surfaced.
The retrieved memories can then be appended to the LLM's prompt as needed, making responses personalized and relevant.
## Common Use Cases
- **Personalized Learning Assistants**: Long-term memory allows learning assistants to remember user preferences, strengths and weaknesses, and progress, providing a more tailored and effective learning experience.
- **Customer Support AI Agents**: By retaining information from previous interactions, customer support bots can offer more accurate and context-aware assistance, improving customer satisfaction and reducing resolution times.
- **Healthcare Assistants**: Long-term memory enables healthcare assistants to keep track of patient history, medication schedules, and treatment plans, ensuring personalized and consistent care.
- **Virtual Companions**: Virtual companions can use long-term memory to build deeper relationships with users by remembering personal details, preferences, and past conversations, making interactions more delightful.
- **Productivity Tools**: Long-term memory helps productivity tools remember user habits, frequently used documents, and task history, streamlining workflows and enhancing efficiency.
- **Gaming AI**: In gaming, AI with long-term memory can create more immersive experiences by remembering player choices, strategies, and progress, adapting the game environment accordingly.
## How is Mem0 different from RAG?
Mem0's memory implementation for Large Language Models (LLMs) offers several advantages over Retrieval-Augmented Generation (RAG):
- **Entity Relationships**: Mem0 can understand and relate entities across different interactions, unlike RAG which retrieves information from static documents. This leads to a deeper understanding of context and relationships.
- **Contextual Continuity**: Mem0 retains information across sessions, maintaining continuity in conversations and interactions, which is essential for long-term engagement applications like virtual companions or personalized learning assistants.
- **Adaptive Learning**: Mem0 improves its personalization based on user interactions and feedback, making the memory more accurate and tailored to individual users over time.
- **Dynamic Updates**: Mem0 can dynamically update its memory with new information and interactions, unlike RAG which relies on static data. This allows for real-time adjustments and improvements, enhancing the user experience.
These advanced memory capabilities make Mem0 a powerful tool for developers aiming to create personalized and context-aware AI applications.
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />
+172
View File
@@ -0,0 +1,172 @@
---
title: Async Client
description: 'Asynchronous client for Mem0'
---
The `AsyncMemoryClient` is an asynchronous client for interacting with the Mem0 API. It provides similar functionality to the synchronous `MemoryClient` but allows for non-blocking operations, which can be beneficial in applications that require high concurrency.
## Initialization
To use the async client, you first need to initialize it:
<CodeGroup>
```python Python
from mem0 import AsyncMemoryClient
client = AsyncMemoryClient(api_key="your-api-key")
```
```javascript JavaScript
const { MemoryClient } = require('mem0ai');
const client = new MemoryClient('your-api-key');
```
</CodeGroup>
## Methods
The `AsyncMemoryClient` provides the following methods:
### Add
Add a new memory asynchronously.
<CodeGroup>
```python Python
messages = [
{"role": "user", "content": "Alice loves playing badminton"},
{"role": "assistant", "content": "That's great! Alice is a fitness freak"},
]
await client.add(messages, user_id="alice")
```
```javascript JavaScript
const messages = [
{"role": "user", "content": "Alice loves playing badminton"},
{"role": "assistant", "content": "That's great! Alice is a fitness freak"},
];
await client.add(messages, { user_id: "alice" });
```
</CodeGroup>
### Search
Search for memories based on a query asynchronously.
<CodeGroup>
```python Python
await client.search(query="What is Alice's favorite sport?", user_id="alice")
```
```javascript JavaScript
await client.search("What is Alice's favorite sport?", { user_id: "alice" });
```
</CodeGroup>
### Get All
Retrieve all memories for a user asynchronously.
<CodeGroup>
```python Python
await client.get_all(user_id="alice")
```
```javascript JavaScript
await client.getAll({ user_id: "alice" });
```
</CodeGroup>
### Delete
Delete a specific memory asynchronously.
<CodeGroup>
```python Python
await client.delete(memory_id="memory-id-here")
```
```javascript JavaScript
await client.delete("memory-id-here");
```
</CodeGroup>
### Delete All
Delete all memories for a user asynchronously.
<CodeGroup>
```python Python
await client.delete_all(user_id="alice")
```
```javascript JavaScript
await client.deleteAll({ user_id: "alice" });
```
</CodeGroup>
### History
Get the history of a specific memory asynchronously.
<CodeGroup>
```python Python
await client.history(memory_id="memory-id-here")
```
```javascript JavaScript
await client.history("memory-id-here");
```
</CodeGroup>
### Users
Get all users, agents, and runs which have memories associated with them asynchronously.
<CodeGroup>
```python Python
await client.users()
```
```javascript JavaScript
await client.users();
```
</CodeGroup>
### Reset
Reset the client, deleting all users and memories asynchronously.
<CodeGroup>
```python Python
await client.reset()
```
```javascript JavaScript
await client.reset();
```
</CodeGroup>
## Conclusion
The `AsyncMemoryClient` provides a powerful way to interact with the Mem0 API asynchronously, allowing for more efficient and responsive applications. By using this client, you can perform memory operations without blocking your application's execution.
If you have any questions or need further assistance, please don't hesitate to reach out:
<Snippet file="get-help.mdx" />
+191
View File
@@ -0,0 +1,191 @@
---
title: Custom Categories
description: 'Enhance your product experience by adding custom categories tailored to your needs'
---
## How to set custom categories?
You can now create custom categories tailored to your specific needs, instead of using the default categories such as travel, sports, music, and more (see [default categories](#default-categories) below). **When custom categories are provided, they will override the default categories.**
There are two ways to set custom categories:
### 1. Project Level
You can set custom categories at the project level, which will be applied to all memories added within that project. Mem0 will automatically assign relevant categories from your custom set to new memories based on their content. Setting custom categories at the project level will override the default categories.
Here's how to set custom categories:
<CodeGroup>
```python Code
from mem0 import MemoryClient
client = MemoryClient(api_key="<your_mem0_api_key>")
# Update custom categories
new_categories = [
{"lifestyle_management_concerns": "Tracks daily routines, habits, hobbies and interests including cooking, time management and work-life balance"},
{"seeking_structure": "Documents goals around creating routines, schedules, and organized systems in various life areas"},
{"personal_information": "Basic information about the user including name, preferences, and personality traits"}
]
response = client.update_custom_instructions_and_categories({"custom_categories": new_categories})
print(response)
```
```json Output
{
"message": "Updated custom categories"
}
```
</CodeGroup>
This is how you will use these custom categories during the `add` API call:
<CodeGroup>
```python Code
messages = [
{"role": "user", "content": "My name is Alice. I need help organizing my daily schedule better. I feel overwhelmed trying to balance work, exercise, and social life."},
{"role": "assistant", "content": "I understand how overwhelming that can feel. Let's break this down together. What specific areas of your schedule feel most challenging to manage?"},
{"role": "user", "content": "I want to be more productive at work, maintain a consistent workout routine, and still have energy for friends and hobbies."},
{"role": "assistant", "content": "Those are great goals for better time management. What's one small change you could make to start improving your daily routine?"},
]
# Add memories with custom categories
client.add(messages, user_id="alice"))
```
```python Memories with categories
# Following categories will be created for the memories added
Wants to have energy for friends and hobbies (lifestyle_management_concerns)
Wants to maintain a consistent workout routine (seeking_structure, lifestyle_management_concerns)
Wants to be more productive at work (lifestyle_management_concerns, seeking_structure)
Name is Alice (personal_information)
```
</CodeGroup>
You can also retrieve the current custom categories:
<CodeGroup>
```python Code
# Get current custom categories
categories = client.get_project(fields=["custom_categories"])
print(categories)
```
```json Output
{
"custom_categories": [
{"lifestyle_management_concerns": "Tracks daily routines, habits, hobbies and interests including cooking, time management and work-life balance"},
{"seeking_structure": "Documents goals around creating routines, schedules, and organized systems in various life areas"},
{"personal_information": "Basic information about the user including name, preferences, and personality traits"}
]
}
```
</CodeGroup>
These project-level categories will be automatically applied to all new memories added to the project.
### 2. During the `add` API call
You can also set custom categories during the `add` API call. This will override any project-level custom categories for that specific memory addition. For example, if you want to use different categories for food-related memories, you can provide custom categories like "food" and "user_preferences" in the `add` call. These custom categories will be used instead of the project-level categories when categorizing those specific memories.
<CodeGroup>
```python Code
from mem0 import MemoryClient
client = MemoryClient(api_key="<your_mem0_api_key>")
custom_categories = [
{"seeking_structure": "Documents goals around creating routines, schedules, and organized systems in various life areas"},
{"personal_information": "Basic information about the user including name, preferences, and personality traits"}
]
messages = [
{"role": "user", "content": "My name is Alice. I need help organizing my daily schedule better. I feel overwhelmed trying to balance work, exercise, and social life."},
{"role": "assistant", "content": "I understand how overwhelming that can feel. Let's break this down together. What specific areas of your schedule feel most challenging to manage?"},
{"role": "user", "content": "I want to be more productive at work, maintain a consistent workout routine, and still have energy for friends and hobbies."},
{"role": "assistant", "content": "Those are great goals for better time management. What's one small change you could make to start improving your daily routine?"},
]
client.add(messages, user_id="alice", custom_categories=custom_categories)
```
```python Memories with categories
# Following categories will be created for the memories added
Wants to have energy for friends and hobbies (seeking_structure)
Wants to maintain a consistent workout routine (seeking_structure)
Wants to be more productive at work (seeking_structure)
Name is Alice (personal_information)
```
</CodeGroup>
<Note>Providing more detailed and specific category descriptions will lead to more accurate and relevant memory categorization.</Note>
## Default Categories
Here is the list of **default categories**. If you don't specify any custom categories using the above methods, these will be used as default categories.
```
- personal_details
- family
- professional_details
- sports
- travel
- food
- music
- health
- technology
- hobbies
- fashion
- entertainment
- milestones
- user_preferences
- misc
```
<CodeGroup>
```python Code
from mem0 import MemoryClient
client = MemoryClient(api_key="<your_mem0_api_key>")
messages = [
{"role": "user", "content": "Hi, my name is Alice."},
{"role": "assistant", "content": "Hi Alice, what sports do you like to play?"},
{"role": "user", "content": "I love playing badminton, football, and basketball. I'm quite athletic!"},
{"role": "assistant", "content": "That's great! Alice seems to enjoy both individual sports like badminton and team sports like football and basketball."},
{"role": "user", "content": "Sometimes, I also draw and sketch in my free time."},
{"role": "assistant", "content": "That's cool! I'm sure you're good at it."}
]
# Add memories with default categories
client.add(messages, user_id='alice')
```
```python Memories with categories
# Following categories will be created for the memories added
Sometimes draws and sketches in free time (hobbies)
Is quite athletic (sports)
Loves playing badminton, football, and basketball (sports)
Name is Alice (personal_details)
```
</CodeGroup>
You can check whether default categories are being used by calling `get_custom_instructions_and_categories()`. If `custom_categories` returns `None`, it means the default categories are being used.
<CodeGroup>
```python Code
client.get_custom_instructions_and_categories(["custom_categories"])
```
```json Output
{
'custom_categories': None
}
```
</CodeGroup>
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />
+74
View File
@@ -0,0 +1,74 @@
---
title: Custom Instructions
description: 'Enhance your product experience by adding custom instructions tailored to your needs'
---
## Introduction to Custom Instructions
Custom instructions allow you to define specific guidelines for your project. This feature helps ensure consistency and provides clear direction for handling project-specific requirements.
Custom instructions are particularly useful when you want to:
- Define how information should be extracted from conversations
- Specify what types of data should be captured or ignored
- Set rules for categorizing and organizing memories
- Maintain consistent handling of project-specific requirements
When custom instructions are set at the project level, they will be applied to all new memories added within that project. This ensures that your data is processed according to your defined guidelines across your entire project.
## Setting Custom Instructions
You can set custom instructions for your project using the following method:
<CodeGroup>
```python Code
# Update custom instructions
prompt ="""
Your Task: Extract ONLY health-related information from conversations, focusing on the following areas:
1. Medical Conditions, Symptoms, and Diagnoses:
- Illnesses, disorders, or symptoms (e.g., fever, diabetes).
- Confirmed or suspected diagnoses.
2. Medications, Treatments, and Procedures:
- Prescription or OTC medications (names, dosages).
- Treatments, therapies, or medical procedures.
3. Diet, Exercise, and Sleep:
- Dietary habits, fitness routines, and sleep patterns.
4. Doctor Visits and Appointments:
- Past, upcoming, or regular medical visits.
5. Health Metrics:
- Data like weight, BP, cholesterol, or sugar levels.
Guidelines:
- Focus solely on health-related content.
- Maintain clarity and context accuracy while recording.
"""
response = client.update_project(custom_instructions=prompt)
print(response)
```
```json Output
{
"message": "Updated custom instructions"
}
```
</CodeGroup>
You can also retrieve the current custom instructions:
<CodeGroup>
```python Code
# Retrieve current custom instructions
response = client.get_project(fields=["custom_instructions"])
print(response)
```
```json Output
{
"custom_instructions": "Your Task: Extract ONLY health-related information from conversations, focusing on the following areas:\n1. Medical Conditions, Symptoms, and Diagnoses - illnesses, disorders, or symptoms (e.g., fever, diabetes), confirmed or suspected diagnoses.\n2. Medications, Treatments, and Procedures - prescription or OTC medications (names, dosages), treatments, therapies, or medical procedures.\n3. Diet, Exercise, and Sleep - dietary habits, fitness routines, and sleep patterns.\n4. Doctor Visits and Appointments - past, upcoming, or regular medical visits.\n5. Health Metrics - data like weight, BP, cholesterol, or sugar levels.\n\nGuidelines: Focus solely on health-related content. Maintain clarity and context accuracy while recording."
}
```
</CodeGroup>
+109
View File
@@ -0,0 +1,109 @@
---
title: Custom Prompts
description: 'Enhance your product experience by adding custom prompts tailored to your needs'
---
## Introduction to Custom Prompts
Custom prompts allow you to tailor the behavior of your Mem0 instance to specific use cases or domains.
By defining a custom prompt, you can control how information is extracted, processed, and stored in your memory system.
To create an effective custom prompt:
1. Be specific about the information to extract.
2. Provide few-shot examples to guide the LLM.
3. Ensure examples follow the format shown below.
Example of a custom prompt:
```python
custom_prompt = """
Please only extract entities containing customer support information, order details, and user information.
Here are some few shot examples:
Input: Hi.
Output: {{"facts" : []}}
Input: The weather is nice today.
Output: {{"facts" : []}}
Input: My order #12345 hasn't arrived yet.
Output: {{"facts" : ["Order #12345 not received"]}}
Input: I'm John Doe, and I'd like to return the shoes I bought last week.
Output: {{"facts" : ["Customer name: John Doe", "Wants to return shoes", "Purchase made last week"]}}
Input: I ordered a red shirt, size medium, but received a blue one instead.
Output: {{"facts" : ["Ordered red shirt, size medium", "Received blue shirt instead"]}}
Return the facts and customer information in a json format as shown above.
"""
```
Here we initialize the custom prompt in the config.
```python
from mem0 import Memory
config = {
"llm": {
"provider": "openai",
"config": {
"model": "gpt-4o",
"temperature": 0.2,
"max_tokens": 1500,
}
},
"custom_prompt": custom_prompt,
"version": "v1.1"
}
m = Memory.from_config(config_dict=config, user_id="alice")
```
### Example 1
In this example, we are adding a memory of a user ordering a laptop. As seen in the output, the custom prompt is used to extract the relevant information from the user's message.
<CodeGroup>
```python Code
m.add("Yesterday, I ordered a laptop, the order id is 12345", user_id="alice")
```
```json Output
{
"results": [
{
"memory": "Ordered a laptop",
"event": "ADD"
},
{
"memory": "Order ID: 12345",
"event": "ADD"
},
{
"memory": "Order placed yesterday",
"event": "ADD"
}
],
"relations": []
}
```
</CodeGroup>
### Example 2
In this example, we are adding a memory of a user liking to go on hikes. This add message is not specific to the use-case mentioned in the custom prompt.
Hence, the memory is not added.
<CodeGroup>
```python Code
m.add("I like going to hikes", user_id="alice")
```
```json Output
{
"results": [],
"relations": []
}
```
</CodeGroup>
+102
View File
@@ -0,0 +1,102 @@
---
title: Direct Import
description: 'Bypass the memory deduction phase and directly store pre-defined memories for efficient retrieval'
---
## How to use Direct Import?
The Direct Import feature allows users to skip the memory deduction phase and directly input pre-defined memories into the system for storage and retrieval.
To enable this feature, you need to set the `infer` parameter to `False` in the `add` method.
<CodeGroup>
```python Python
messages = [
{"role": "user", "content": "Alice loves playing badminton"},
{"role": "assistant", "content": "That's great! Alice is a fitness freak"},
{"role": "user", "content": "Alice mostly cook at home because of gym plan"},
]
client.add(messages, user_id="alice", infer=False)
```
```markdown Output
[]
```
</CodeGroup>
You can see that the output of add call is an empty list.
<Note> Only messages with the role "user" will be used for storage. Messages with roles such as "assistant" or "system" will be ignored during the storage process. </Note>
## How to retrieve memories?
You can retrieve memories using the `search` method.
<CodeGroup>
```python Python
client.search(query="What is Alice's favorite sport?", user_id="alice", output_format="v1.1")
```
```json Output
{
"results": [
{
"id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1",
"memory": "Alice loves playing badminton",
"user_id": "pc123",
"metadata": null,
"categories": null,
"created_at": "2024-10-15T21:52:11.474901-07:00",
"updated_at": "2024-10-15T21:52:11.474912-07:00"
}
]
}
```
</CodeGroup>
## How to retrieve all memories?
You can retrieve all memories using the `get_all` method.
<CodeGroup>
```python Python
client.get_all(query="What is Alice's favorite sport?", user_id="alice", output_format="v1.1")
```
```json Output
{
"results": [
{
"id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1",
"memory": "Alice loves playing badminton",
"user_id": "pc123",
"metadata": null,
"categories": null,
"created_at": "2024-10-15T21:52:11.474901-07:00",
"updated_at": "2024-10-15T21:52:11.474912-07:00"
},
{
"id": "8557f05d-7b3c-47e5-b409-9886f9e314fc",
"memory": "Alice mostly cook at home because of gym plan",
"user_id": "pc123",
"metadata": null,
"categories": null,
"created_at": "2024-10-15T21:52:11.474929-07:00",
"updated_at": "2024-10-15T21:52:11.474932-07:00"
}
]
}
```
</CodeGroup>
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />
+328
View File
@@ -0,0 +1,328 @@
---
title: Langchain Tools
description: 'Integrate Mem0 with LangChain tools to enable AI agents to store, search, and manage memories through structured interfaces'
---
## Overview
Mem0 provides a suite of tools for storing, searching, and retrieving memories, enabling agents to maintain context and learn from past interactions. The tools are built as Langchain tools, making them easily integrable with any AI agent implementation.
## Installation
Install the required dependencies:
```bash
pip install langchain_core
pip install mem0ai
```
## Authentication
Import the necessary dependencies and initialize the client:
```python
from langchain_core.tools import StructuredTool
from mem0 import MemoryClient
from pydantic import BaseModel, Field
from typing import List, Dict, Any, Optional
client = MemoryClient(
api_key=your_api_key,
org_id=your_org_id,
project_id=your_project_id
)
```
## Available Tools
Mem0 provides three main tools for memory management:
### 1. ADD Memory Tool
The ADD tool allows you to store new memories with associated metadata. It's particularly useful for saving conversation history and user preferences.
#### Schema
```python
class Message(BaseModel):
role: str = Field(description="Role of the message sender (user or assistant)")
content: str = Field(description="Content of the message")
class AddMemoryInput(BaseModel):
messages: List[Message] = Field(description="List of messages to add to memory")
user_id: str = Field(description="ID of the user associated with these messages")
output_format: str = Field(description="Version format for the output")
metadata: Optional[Dict[str, Any]] = Field(description="Additional metadata for the messages", default=None)
class Config:
json_schema_extra = {
"examples": [{
"messages": [
{"role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts."},
{"role": "assistant", "content": "Hello Alex! I've noted that you're a vegetarian and have a nut allergy."}
],
"user_id": "alex",
"output_format": "v1.1",
"metadata": {"food": "vegan"}
}]
}
```
#### Implementation
```python
def add_memory(messages: List[Message], user_id: str, output_format: str, metadata: Optional[Dict[str, Any]] = None) -> Any:
"""Add messages to memory with associated user ID and metadata."""
message_dicts = [msg.dict() for msg in messages]
return client.add(message_dicts, user_id=user_id, output_format=output_format, metadata=metadata)
add_tool = StructuredTool(
name="add_memory",
description="Add new messages to memory with associated metadata",
func=add_memory,
args_schema=AddMemoryInput
)
```
#### Example Usage
<CodeGroup>
```python Code
add_input = {
"messages": [
{"role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts."},
{"role": "assistant", "content": "Hello Alex! I've noted that you're a vegetarian and have a nut allergy."}
],
"user_id": "alex123",
"output_format": "v1.1",
"metadata": {"food": "vegan"}
}
add_result = add_tool.invoke(add_input)
```
```json Output
{
"results": [
{
"memory": "Name is Alex",
"event": "ADD"
},
{
"memory": "Is a vegetarian",
"event": "ADD"
},
{
"memory": "Is allergic to nuts",
"event": "ADD"
}
]
}
```
</CodeGroup>
### 2. SEARCH Memory Tool
The SEARCH tool enables querying stored memories using natural language queries and advanced filtering options.
#### Schema
```python
class SearchMemoryInput(BaseModel):
query: str = Field(description="The search query string")
filters: Dict[str, Any] = Field(description="Filters to apply to the search")
version: str = Field(description="Version of the memory to search")
class Config:
json_schema_extra = {
"examples": [{
"query": "tell me about my allergies?",
"filters": {
"AND": [
{"user_id": "alex"},
{"created_at": {"gte": "2024-01-01", "lte": "2024-12-31"}}
]
},
"version": "v2"
}]
}
```
#### Implementation
```python
def search_memory(query: str, filters: Dict[str, Any], version: str) -> Any:
"""Search memory with the given query and filters."""
return client.search(query=query, version=version, filters=filters)
search_tool = StructuredTool(
name="search_memory",
description="Search through memories with a query and filters",
func=search_memory,
args_schema=SearchMemoryInput
)
```
#### Example Usage
<CodeGroup>
```python Code
search_input = {
"query": "what is my name?",
"filters": {
"AND": [
{"created_at": {"gte": "2024-07-20", "lte": "2024-12-10"}},
{"user_id": "alex123"}
]
},
"version": "v2"
}
result = search_tool.invoke(search_input)
```
```json Output
[
{
"id": "1a75e827-7eca-45ea-8c5c-cfd43299f061",
"memory": "Name is Alex",
"user_id": "alex123",
"hash": "d0fccc8fa47f7a149ee95750c37bb0ca",
"metadata": {
"food": "vegan"
},
"categories": [
"personal_details"
],
"created_at": "2024-11-27T16:53:43.276872-08:00",
"updated_at": "2024-11-27T16:53:43.276885-08:00",
"score": 0.3810526501504994
}
]
```
</CodeGroup>
### 3. GET_ALL Memory Tool
The GET_ALL tool retrieves all memories matching specified criteria, with support for pagination.
#### Schema
```python
class GetAllMemoryInput(BaseModel):
version: str = Field(description="Version of the memory to retrieve")
filters: Dict[str, Any] = Field(description="Filters to apply to the retrieval")
page: Optional[int] = Field(description="Page number for pagination", default=1)
page_size: Optional[int] = Field(description="Number of items per page", default=50)
class Config:
json_schema_extra = {
"examples": [{
"version": "v2",
"filters": {
"AND": [
{"user_id": "alex"},
{"created_at": {"gte": "2024-07-01", "lte": "2024-07-31"}},
{"categories": {"contains": "food_preferences"}}
]
},
"page": 1,
"page_size": 50
}]
}
```
#### Implementation
```python
def get_all_memory(version: str, filters: Dict[str, Any], page: int = 1, page_size: int = 50) -> Any:
"""Retrieve all memories matching the specified criteria."""
return client.get_all(version=version, filters=filters, page=page, page_size=page_size)
get_all_tool = StructuredTool(
name="get_all_memory",
description="Retrieve all memories matching specified filters",
func=get_all_memory,
args_schema=GetAllMemoryInput
)
```
#### Example Usage
<CodeGroup>
```python Code
get_all_input = {
"version": "v2",
"filters": {
"AND": [
{"user_id": "alex123"},
{"created_at": {"gte": "2024-07-01", "lte": "2024-12-31"}}
]
},
"page": 1,
"page_size": 50
}
get_all_result = get_all_tool.invoke(get_all_input)
```
```json Output
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": "1a75e827-7eca-45ea-8c5c-cfd43299f061",
"memory": "Name is Alex",
"user_id": "alex123",
"hash": "d0fccc8fa47f7a149ee95750c37bb0ca",
"metadata": {
"food": "vegan"
},
"categories": [
"personal_details"
],
"created_at": "2024-11-27T16:53:43.276872-08:00",
"updated_at": "2024-11-27T16:53:43.276885-08:00"
},
{
"id": "91509588-0b39-408a-8df3-84b3bce8c521",
"memory": "Is a vegetarian",
"user_id": "alex123",
"hash": "ce6b1c84586772ab9995a9477032df99",
"metadata": {
"food": "vegan"
},
"categories": [
"user_preferences",
"food"
],
"created_at": "2024-11-27T16:53:43.308027-08:00",
"updated_at": "2024-11-27T16:53:43.308037-08:00"
},
{
"id": "8d74f7a0-6107-4589-bd6f-210f6bf4fbbb",
"memory": "Is allergic to nuts",
"user_id": "alex123",
"hash": "7873cd0e5a29c513253d9fad038e758b",
"metadata": {
"food": "vegan"
},
"categories": [
"health"
],
"created_at": "2024-11-27T16:53:43.337253-08:00",
"updated_at": "2024-11-27T16:53:43.337262-08:00"
}
]
}
```
</CodeGroup>
## Integration with AI Agents
All tools are implemented as Langchain `StructuredTool` instances, making them compatible with any AI agent that supports the Langchain tools interface. To use these tools with your agent:
1. Initialize the tools as shown above
2. Add the tools to your agent's toolset
3. The agent can now use these tools to manage memories through natural language interactions
Each tool provides structured input validation through Pydantic models and returns consistent responses that can be processed by your agent.
+145
View File
@@ -0,0 +1,145 @@
---
title: Memory Export
description: 'Export memories in a structured format using customizable Pydantic schemas'
---
## Overview
The Memory Export feature allows you to create structured exports of memories using customizable Pydantic schemas. This process enables you to transform your stored memories into specific data formats that match your needs. You can apply various filters to narrow down which memories to export and define exactly how the data should be structured.
## Creating a Memory Export
To create a memory export, you'll need to:
1. Define your schema structure
2. Submit an export job
3. Retrieve the exported data
### Define Schema
Here's an example schema for extracting professional profile information:
```json
{
"$defs": {
"EducationLevel": {
"enum": ["high_school", "bachelors", "masters"],
"title": "EducationLevel",
"type": "string"
},
"EmploymentStatus": {
"enum": ["full_time", "part_time", "student"],
"title": "EmploymentStatus",
"type": "string"
}
},
"properties": {
"full_name": {
"anyOf": [
{
"maxLength": 100,
"minLength": 2,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The professional's full name",
"title": "Full Name"
},
"current_role": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Current job title or role",
"title": "Current Role"
}
},
"title": "ProfessionalProfile",
"type": "object"
}
```
### Submit Export Job
<CodeGroup>
```python Python
response = client.create_memory_export(
schema=json_schema,
user_id="user123"
)
print(response)
```
```bash cURL
curl -X POST "https://api.mem0.ai/v1/memories/export/" \
-H "Authorization: Token your-api-key" \
-H "Content-Type: application/json" \
-d '{
"schema": {json_schema},
"user_id": "user123"
}'
```
```json Output
{
"message": "Memory export request received. The export will be ready in a few seconds.",
"id": "550e8400-e29b-41d4-a716-446655440000"
}
```
</CodeGroup>
### Retrieve Export
Once the export job is complete, you can retrieve the structured data:
<CodeGroup>
```python Python
response = client.get_memory_export(user_id="user123")
print(response)
```
```bash cURL
curl -X GET "https://api.mem0.ai/v1/memories/export/?user_id=user123" \
-H "Authorization: Token your-api-key"
```
```json Output
{
"full_name": "John Doe",
"current_role": "Senior Software Engineer",
"years_experience": 8,
"employment_status": "full_time",
"education_level": "masters",
"skills": ["Python", "AWS", "Machine Learning"]
}
```
</CodeGroup>
## Available Filters
You can apply various filters to customize which memories are included in the export:
- `user_id`: Filter memories by specific user
- `agent_id`: Filter memories by specific agent
- `run_id`: Filter memories by specific run
- `session_id`: Filter memories by specific session
<Note>
The export process may take some time to complete, especially when dealing with a large number of memories or complex schemas.
</Note>
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />

Some files were not shown because too many files have changed in this diff Show More