You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

pyproject.toml 3.6 kB

5663 ollama client host (#5674) @ekzhu should likely be assigned as reviewer ## Why are these changes needed? These changes address the bug reported in #5663. Prevents TypeError from being thrown at inference time by ollama AsyncClient when `host` (and other) kwargs are passed to autogen OllamaChatCompletionClient constructor. It also adds ollama as a named optional extra so that the ollama requirements can be installed alongside autogen-ext (e.g. `pip install autogen-ext[ollama]` @ekzhu, I will need some help or guidance to ensure that the associated test (which requires ollama and tiktoken as dependencies of the OllamaChatCompletionClient) can run successfully in autogen's test execution environment. I have also left the "I've made sure all auto checks have passed" check below unchecked as this PR is coming from my fork. (UPDATE: auto checks appear to have passed after opening PR, so I have checked box below) ## Related issue number Intended to close #5663 ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed. --------- Co-authored-by: Ryan Stewart <ryanstewart@Ryans-MacBook-Pro.local> Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com> Co-authored-by: peterychang <49209570+peterychang@users.noreply.github.com>
1 year ago
Graphrag integration (#4612) * add initial global search draft * add graphrag dep * fix local search embedding * linting * add from config constructor * remove draft notebook * update config factory and add docstrings * add graphrag sample * add sample prompts * update readme * update deps * Add API docs * Update python/samples/agentchat_graphrag/requirements.txt * Update python/samples/agentchat_graphrag/requirements.txt * update docstrings with snippet and doc ref * lint * improve set up instructions in docstring * lint * update lock * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * add unit tests * update lock * update uv lock * add docstring newlines * stubs and typing on graphrag tests * fix docstrings * fix mypy error * + linting and type fixes * type fix graphrag sample * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/samples/agentchat_graphrag/requirements.txt Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * update overrides * fix docstring client imports * additional docstring fix * add docstring missing import * use openai and fix db path * use console for displaying messages * add model config and gitignore * update readme * lint * Update python/samples/agentchat_graphrag/README.md * Update python/samples/agentchat_graphrag/README.md * Comment remaining azure config --------- Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com> Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
1 year ago
Add ChromaDBVectorMemory in Extensions (#5308) <!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> Shows an example of how to use the `Memory` interface to implement a just-in-time vector memory based on chromadb. ```python import os from pathlib import Path from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.ui import Console from autogen_core.memory import MemoryContent, MemoryMimeType from autogen_ext.memory.chromadb import ChromaDBVectorMemory, PersistentChromaDBVectorMemoryConfig from autogen_ext.models.openai import OpenAIChatCompletionClient # Initialize ChromaDB memory with custom config chroma_user_memory = ChromaDBVectorMemory( config=PersistentChromaDBVectorMemoryConfig( collection_name="preferences", persistence_path=os.path.join(str(Path.home()), ".chromadb_autogen"), k=2, # Return top k results score_threshold=0.4, # Minimum similarity score ) ) # a HttpChromaDBVectorMemoryConfig is also supported for connecting to a remote ChromaDB server # Add user preferences to memory await chroma_user_memory.add( MemoryContent( content="The weather should be in metric units", mime_type=MemoryMimeType.TEXT, metadata={"category": "preferences", "type": "units"}, ) ) await chroma_user_memory.add( MemoryContent( content="Meal recipe must be vegan", mime_type=MemoryMimeType.TEXT, metadata={"category": "preferences", "type": "dietary"}, ) ) # Create assistant agent with ChromaDB memory assistant_agent = AssistantAgent( name="assistant_agent", model_client=OpenAIChatCompletionClient( model="gpt-4o", ), tools=[get_weather], memory=[user_memory], ) stream = assistant_agent.run_stream(task="What is the weather in New York?") await Console(stream) await user_memory.close() ``` ```txt ---------- user ---------- What is the weather in New York? ---------- assistant_agent ---------- [MemoryContent(content='The weather should be in metric units', mime_type='MemoryMimeType.TEXT', metadata={'category': 'preferences', 'mime_type': 'MemoryMimeType.TEXT', 'type': 'units', 'score': 0.4342913043162201, 'id': '8a8d683c-5866-41e1-ac17-08c4fda6da86'}), MemoryContent(content='The weather should be in metric units', mime_type='MemoryMimeType.TEXT', metadata={'category': 'preferences', 'mime_type': 'MemoryMimeType.TEXT', 'type': 'units', 'score': 0.4342913043162201, 'id': 'f27af42c-cb63-46f0-b26b-ffcc09955ca1'})] ---------- assistant_agent ---------- [FunctionCall(id='call_a8U3YEj2dxA065vyzdfXDtNf', arguments='{"city":"New York","units":"metric"}', name='get_weather')] ---------- assistant_agent ---------- [FunctionExecutionResult(content='The weather in New York is 23 °C and Sunny.', call_id='call_a8U3YEj2dxA065vyzdfXDtNf', is_error=False)] ---------- assistant_agent ---------- The weather in New York is 23 °C and Sunny. ``` Note that MemoryContent object in the MemoryQuery events have useful metadata like the score and id retrieved memories. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://microsoft.github.io/autogen/docs/Contribute#documentation to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed.
1 year ago
Graphrag integration (#4612) * add initial global search draft * add graphrag dep * fix local search embedding * linting * add from config constructor * remove draft notebook * update config factory and add docstrings * add graphrag sample * add sample prompts * update readme * update deps * Add API docs * Update python/samples/agentchat_graphrag/requirements.txt * Update python/samples/agentchat_graphrag/requirements.txt * update docstrings with snippet and doc ref * lint * improve set up instructions in docstring * lint * update lock * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * add unit tests * update lock * update uv lock * add docstring newlines * stubs and typing on graphrag tests * fix docstrings * fix mypy error * + linting and type fixes * type fix graphrag sample * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * Update python/samples/agentchat_graphrag/requirements.txt Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * update overrides * fix docstring client imports * additional docstring fix * add docstring missing import * use openai and fix db path * use console for displaying messages * add model config and gitignore * update readme * lint * Update python/samples/agentchat_graphrag/README.md * Update python/samples/agentchat_graphrag/README.md * Comment remaining azure config --------- Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com> Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. [build-system]
  2. requires = ["hatchling"]
  3. build-backend = "hatchling.build"
  4. [project]
  5. name = "autogen-ext"
  6. version = "0.4.8"
  7. license = {file = "LICENSE-CODE"}
  8. description = "AutoGen extensions library"
  9. readme = "README.md"
  10. requires-python = ">=3.10"
  11. classifiers = [
  12. "Programming Language :: Python :: 3",
  13. "License :: OSI Approved :: MIT License",
  14. "Operating System :: OS Independent",
  15. ]
  16. dependencies = [
  17. "autogen-core==0.4.8",
  18. ]
  19. [project.optional-dependencies]
  20. langchain = ["langchain_core~= 0.3.3"]
  21. azure = [
  22. "azure-ai-inference>=1.0.0b7",
  23. "azure-core",
  24. "azure-identity",
  25. ]
  26. docker = ["docker~=7.0", "asyncio_atexit>=1.0.1"]
  27. ollama = ["ollama>=0.4.7", "tiktoken>=0.8.0"]
  28. openai = ["openai>=1.52.2", "tiktoken>=0.8.0", "aiofiles"]
  29. file-surfer = [
  30. "autogen-agentchat==0.4.8",
  31. "markitdown>=0.0.1a2",
  32. ]
  33. graphrag = ["graphrag>=1.0.1"]
  34. chromadb = ["chromadb"]
  35. web-surfer = [
  36. "autogen-agentchat==0.4.8",
  37. "playwright>=1.48.0",
  38. "pillow>=11.0.0",
  39. "markitdown>=0.0.1a2",
  40. ]
  41. magentic-one = [
  42. "autogen-agentchat==0.4.8",
  43. "markitdown>=0.0.1a2",
  44. "playwright>=1.48.0",
  45. "pillow>=11.0.0",
  46. ]
  47. video-surfer = [
  48. "autogen-agentchat==0.4.8",
  49. "opencv-python>=4.5",
  50. "ffmpeg-python",
  51. "openai-whisper",
  52. ]
  53. diskcache = [
  54. "diskcache>=5.6.3"
  55. ]
  56. redis = [
  57. "redis>=5.2.1"
  58. ]
  59. grpc = [
  60. "grpcio~=1.70.0",
  61. ]
  62. jupyter-executor = [
  63. "ipykernel>=6.29.5",
  64. "nbclient>=0.10.2",
  65. ]
  66. semantic-kernel-core = [
  67. "semantic-kernel>=1.17.1",
  68. ]
  69. gemini = [
  70. "google-genai>=1.0.0",
  71. ]
  72. semantic-kernel-google = [
  73. "semantic-kernel[google]>=1.17.1",
  74. ]
  75. semantic-kernel-hugging-face = [
  76. "semantic-kernel[hugging_face]>=1.17.1",
  77. ]
  78. semantic-kernel-mistralai = [
  79. "semantic-kernel[mistralai]>=1.17.1",
  80. ]
  81. semantic-kernel-ollama = [
  82. "semantic-kernel[ollama]>=1.17.1",
  83. ]
  84. semantic-kernel-onnx = [
  85. "semantic-kernel[onnx]>=1.17.1",
  86. ]
  87. semantic-kernel-anthropic = [
  88. "semantic-kernel[anthropic]>=1.17.1",
  89. ]
  90. semantic-kernel-pandas = [
  91. "semantic-kernel[pandas]>=1.17.1",
  92. ]
  93. semantic-kernel-aws = [
  94. "semantic-kernel[aws]>=1.17.1",
  95. ]
  96. semantic-kernel-dapr = [
  97. "semantic-kernel[dapr]>=1.17.1",
  98. ]
  99. http-tool = [
  100. "httpx>=0.27.0",
  101. "json-schema-to-pydantic>=0.2.0"
  102. ]
  103. semantic-kernel-all = [
  104. "semantic-kernel[google,hugging_face,mistralai,ollama,onnx,anthropic,usearch,pandas,aws,dapr]>=1.17.1",
  105. ]
  106. rich = ["rich>=13.9.4"]
  107. mcp = [
  108. "mcp>=1.1.3",
  109. "json-schema-to-pydantic>=0.2.2"
  110. ]
  111. [tool.hatch.build.targets.wheel]
  112. packages = ["src/autogen_ext"]
  113. [dependency-groups]
  114. dev = [
  115. "autogen_test_utils",
  116. "langchain-experimental",
  117. "pandas-stubs>=2.2.3.241126",
  118. "httpx>=0.28.1",
  119. ]
  120. [tool.ruff]
  121. extend = "../../pyproject.toml"
  122. include = ["src/**", "tests/*.py"]
  123. exclude = ["src/autogen_ext/agents/web_surfer/*.js", "src/autogen_ext/runtimes/grpc/protos", "tests/protos"]
  124. [tool.pyright]
  125. extends = "../../pyproject.toml"
  126. include = ["src", "tests"]
  127. exclude = ["src/autogen_ext/runtimes/grpc/protos", "tests/protos"]
  128. [tool.pytest.ini_options]
  129. minversion = "6.0"
  130. testpaths = ["tests"]
  131. markers = [
  132. "grpc",
  133. ]
  134. [tool.poe]
  135. include = "../../shared_tasks.toml"
  136. [tool.poe.tasks]
  137. test.sequence = [
  138. "playwright install",
  139. "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml",
  140. ]
  141. test.default_item_type = "cmd"
  142. test-grpc = "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml --grpc"
  143. mypy = "mypy --config-file ../../pyproject.toml --exclude src/autogen_ext/runtimes/grpc/protos --exclude tests/protos src tests"
  144. [tool.mypy]
  145. [[tool.mypy.overrides]]
  146. module = "docker.*"
  147. ignore_missing_imports = true