ag2 0.4.1__py3-none-any.whl → 0.4.2b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ag2 might be problematic. Click here for more details.
- ag2-0.4.2b1.dist-info/METADATA +19 -0
- ag2-0.4.2b1.dist-info/RECORD +6 -0
- ag2-0.4.2b1.dist-info/top_level.txt +1 -0
- ag2-0.4.1.dist-info/METADATA +0 -500
- ag2-0.4.1.dist-info/RECORD +0 -158
- ag2-0.4.1.dist-info/top_level.txt +0 -1
- autogen/__init__.py +0 -17
- autogen/_pydantic.py +0 -116
- autogen/agentchat/__init__.py +0 -42
- autogen/agentchat/agent.py +0 -142
- autogen/agentchat/assistant_agent.py +0 -85
- autogen/agentchat/chat.py +0 -306
- autogen/agentchat/contrib/__init__.py +0 -0
- autogen/agentchat/contrib/agent_builder.py +0 -788
- autogen/agentchat/contrib/agent_eval/agent_eval.py +0 -107
- autogen/agentchat/contrib/agent_eval/criterion.py +0 -47
- autogen/agentchat/contrib/agent_eval/critic_agent.py +0 -47
- autogen/agentchat/contrib/agent_eval/quantifier_agent.py +0 -42
- autogen/agentchat/contrib/agent_eval/subcritic_agent.py +0 -48
- autogen/agentchat/contrib/agent_eval/task.py +0 -43
- autogen/agentchat/contrib/agent_optimizer.py +0 -450
- autogen/agentchat/contrib/capabilities/__init__.py +0 -0
- autogen/agentchat/contrib/capabilities/agent_capability.py +0 -21
- autogen/agentchat/contrib/capabilities/generate_images.py +0 -297
- autogen/agentchat/contrib/capabilities/teachability.py +0 -406
- autogen/agentchat/contrib/capabilities/text_compressors.py +0 -72
- autogen/agentchat/contrib/capabilities/transform_messages.py +0 -92
- autogen/agentchat/contrib/capabilities/transforms.py +0 -565
- autogen/agentchat/contrib/capabilities/transforms_util.py +0 -120
- autogen/agentchat/contrib/capabilities/vision_capability.py +0 -217
- autogen/agentchat/contrib/captainagent/tools/__init__.py +0 -0
- autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_correlation.py +0 -41
- autogen/agentchat/contrib/captainagent/tools/data_analysis/calculate_skewness_and_kurtosis.py +0 -29
- autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_iqr.py +0 -29
- autogen/agentchat/contrib/captainagent/tools/data_analysis/detect_outlier_zscore.py +0 -29
- autogen/agentchat/contrib/captainagent/tools/data_analysis/explore_csv.py +0 -22
- autogen/agentchat/contrib/captainagent/tools/data_analysis/shapiro_wilk_test.py +0 -31
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_download.py +0 -26
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/arxiv_search.py +0 -55
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_image.py +0 -54
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/extract_pdf_text.py +0 -39
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_wikipedia_text.py +0 -22
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/get_youtube_caption.py +0 -35
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/image_qa.py +0 -61
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/optical_character_recognition.py +0 -62
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/perform_web_search.py +0 -48
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/scrape_wikipedia_tables.py +0 -34
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/transcribe_audio_file.py +0 -22
- autogen/agentchat/contrib/captainagent/tools/information_retrieval/youtube_download.py +0 -36
- autogen/agentchat/contrib/captainagent/tools/math/calculate_circle_area_from_diameter.py +0 -22
- autogen/agentchat/contrib/captainagent/tools/math/calculate_day_of_the_week.py +0 -19
- autogen/agentchat/contrib/captainagent/tools/math/calculate_fraction_sum.py +0 -29
- autogen/agentchat/contrib/captainagent/tools/math/calculate_matrix_power.py +0 -32
- autogen/agentchat/contrib/captainagent/tools/math/calculate_reflected_point.py +0 -17
- autogen/agentchat/contrib/captainagent/tools/math/complex_numbers_product.py +0 -26
- autogen/agentchat/contrib/captainagent/tools/math/compute_currency_conversion.py +0 -24
- autogen/agentchat/contrib/captainagent/tools/math/count_distinct_permutations.py +0 -28
- autogen/agentchat/contrib/captainagent/tools/math/evaluate_expression.py +0 -29
- autogen/agentchat/contrib/captainagent/tools/math/find_continuity_point.py +0 -35
- autogen/agentchat/contrib/captainagent/tools/math/fraction_to_mixed_numbers.py +0 -40
- autogen/agentchat/contrib/captainagent/tools/math/modular_inverse_sum.py +0 -23
- autogen/agentchat/contrib/captainagent/tools/math/simplify_mixed_numbers.py +0 -37
- autogen/agentchat/contrib/captainagent/tools/math/sum_of_digit_factorials.py +0 -16
- autogen/agentchat/contrib/captainagent/tools/math/sum_of_primes_below.py +0 -16
- autogen/agentchat/contrib/captainagent/tools/requirements.txt +0 -10
- autogen/agentchat/contrib/captainagent/tools/tool_description.tsv +0 -34
- autogen/agentchat/contrib/captainagent.py +0 -490
- autogen/agentchat/contrib/gpt_assistant_agent.py +0 -545
- autogen/agentchat/contrib/graph_rag/__init__.py +0 -0
- autogen/agentchat/contrib/graph_rag/document.py +0 -30
- autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py +0 -111
- autogen/agentchat/contrib/graph_rag/falkor_graph_rag_capability.py +0 -81
- autogen/agentchat/contrib/graph_rag/graph_query_engine.py +0 -56
- autogen/agentchat/contrib/graph_rag/graph_rag_capability.py +0 -64
- autogen/agentchat/contrib/img_utils.py +0 -390
- autogen/agentchat/contrib/llamaindex_conversable_agent.py +0 -123
- autogen/agentchat/contrib/llava_agent.py +0 -176
- autogen/agentchat/contrib/math_user_proxy_agent.py +0 -471
- autogen/agentchat/contrib/multimodal_conversable_agent.py +0 -128
- autogen/agentchat/contrib/qdrant_retrieve_user_proxy_agent.py +0 -325
- autogen/agentchat/contrib/retrieve_assistant_agent.py +0 -56
- autogen/agentchat/contrib/retrieve_user_proxy_agent.py +0 -705
- autogen/agentchat/contrib/society_of_mind_agent.py +0 -203
- autogen/agentchat/contrib/swarm_agent.py +0 -463
- autogen/agentchat/contrib/text_analyzer_agent.py +0 -76
- autogen/agentchat/contrib/tool_retriever.py +0 -120
- autogen/agentchat/contrib/vectordb/__init__.py +0 -0
- autogen/agentchat/contrib/vectordb/base.py +0 -243
- autogen/agentchat/contrib/vectordb/chromadb.py +0 -326
- autogen/agentchat/contrib/vectordb/mongodb.py +0 -559
- autogen/agentchat/contrib/vectordb/pgvectordb.py +0 -958
- autogen/agentchat/contrib/vectordb/qdrant.py +0 -334
- autogen/agentchat/contrib/vectordb/utils.py +0 -126
- autogen/agentchat/contrib/web_surfer.py +0 -305
- autogen/agentchat/conversable_agent.py +0 -2908
- autogen/agentchat/groupchat.py +0 -1668
- autogen/agentchat/user_proxy_agent.py +0 -109
- autogen/agentchat/utils.py +0 -207
- autogen/browser_utils.py +0 -291
- autogen/cache/__init__.py +0 -10
- autogen/cache/abstract_cache_base.py +0 -78
- autogen/cache/cache.py +0 -182
- autogen/cache/cache_factory.py +0 -85
- autogen/cache/cosmos_db_cache.py +0 -150
- autogen/cache/disk_cache.py +0 -109
- autogen/cache/in_memory_cache.py +0 -61
- autogen/cache/redis_cache.py +0 -128
- autogen/code_utils.py +0 -745
- autogen/coding/__init__.py +0 -22
- autogen/coding/base.py +0 -113
- autogen/coding/docker_commandline_code_executor.py +0 -262
- autogen/coding/factory.py +0 -45
- autogen/coding/func_with_reqs.py +0 -203
- autogen/coding/jupyter/__init__.py +0 -22
- autogen/coding/jupyter/base.py +0 -32
- autogen/coding/jupyter/docker_jupyter_server.py +0 -164
- autogen/coding/jupyter/embedded_ipython_code_executor.py +0 -182
- autogen/coding/jupyter/jupyter_client.py +0 -224
- autogen/coding/jupyter/jupyter_code_executor.py +0 -161
- autogen/coding/jupyter/local_jupyter_server.py +0 -168
- autogen/coding/local_commandline_code_executor.py +0 -410
- autogen/coding/markdown_code_extractor.py +0 -44
- autogen/coding/utils.py +0 -57
- autogen/exception_utils.py +0 -46
- autogen/extensions/__init__.py +0 -0
- autogen/formatting_utils.py +0 -76
- autogen/function_utils.py +0 -362
- autogen/graph_utils.py +0 -148
- autogen/io/__init__.py +0 -15
- autogen/io/base.py +0 -105
- autogen/io/console.py +0 -43
- autogen/io/websockets.py +0 -213
- autogen/logger/__init__.py +0 -11
- autogen/logger/base_logger.py +0 -140
- autogen/logger/file_logger.py +0 -287
- autogen/logger/logger_factory.py +0 -29
- autogen/logger/logger_utils.py +0 -42
- autogen/logger/sqlite_logger.py +0 -459
- autogen/math_utils.py +0 -356
- autogen/oai/__init__.py +0 -33
- autogen/oai/anthropic.py +0 -428
- autogen/oai/bedrock.py +0 -606
- autogen/oai/cerebras.py +0 -270
- autogen/oai/client.py +0 -1148
- autogen/oai/client_utils.py +0 -167
- autogen/oai/cohere.py +0 -453
- autogen/oai/completion.py +0 -1216
- autogen/oai/gemini.py +0 -469
- autogen/oai/groq.py +0 -281
- autogen/oai/mistral.py +0 -279
- autogen/oai/ollama.py +0 -582
- autogen/oai/openai_utils.py +0 -811
- autogen/oai/together.py +0 -343
- autogen/retrieve_utils.py +0 -487
- autogen/runtime_logging.py +0 -163
- autogen/token_count_utils.py +0 -259
- autogen/types.py +0 -20
- autogen/version.py +0 -7
- {ag2-0.4.1.dist-info → ag2-0.4.2b1.dist-info}/LICENSE +0 -0
- {ag2-0.4.1.dist-info → ag2-0.4.2b1.dist-info}/NOTICE.md +0 -0
- {ag2-0.4.1.dist-info → ag2-0.4.2b1.dist-info}/WHEEL +0 -0
autogen/cache/redis_cache.py
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
#
|
|
5
|
-
# Portions derived from https://github.com/microsoft/autogen are under the MIT License.
|
|
6
|
-
# SPDX-License-Identifier: MIT
|
|
7
|
-
import pickle
|
|
8
|
-
import sys
|
|
9
|
-
from types import TracebackType
|
|
10
|
-
from typing import Any, Optional, Type, Union
|
|
11
|
-
|
|
12
|
-
import redis
|
|
13
|
-
|
|
14
|
-
from .abstract_cache_base import AbstractCache
|
|
15
|
-
|
|
16
|
-
if sys.version_info >= (3, 11):
|
|
17
|
-
from typing import Self
|
|
18
|
-
else:
|
|
19
|
-
from typing_extensions import Self
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class RedisCache(AbstractCache):
|
|
23
|
-
"""
|
|
24
|
-
Implementation of AbstractCache using the Redis database.
|
|
25
|
-
|
|
26
|
-
This class provides a concrete implementation of the AbstractCache
|
|
27
|
-
interface using the Redis database for caching data.
|
|
28
|
-
|
|
29
|
-
Attributes:
|
|
30
|
-
seed (Union[str, int]): A seed or namespace used as a prefix for cache keys.
|
|
31
|
-
cache (redis.Redis): The Redis client used for caching.
|
|
32
|
-
|
|
33
|
-
Methods:
|
|
34
|
-
__init__(self, seed, redis_url): Initializes the RedisCache with the given seed and Redis URL.
|
|
35
|
-
_prefixed_key(self, key): Internal method to get a namespaced cache key.
|
|
36
|
-
get(self, key, default=None): Retrieves an item from the cache.
|
|
37
|
-
set(self, key, value): Sets an item in the cache.
|
|
38
|
-
close(self): Closes the Redis client.
|
|
39
|
-
__enter__(self): Context management entry.
|
|
40
|
-
__exit__(self, exc_type, exc_value, traceback): Context management exit.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
def __init__(self, seed: Union[str, int], redis_url: str):
|
|
44
|
-
"""
|
|
45
|
-
Initialize the RedisCache instance.
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
seed (Union[str, int]): A seed or namespace for the cache. This is used as a prefix for all cache keys.
|
|
49
|
-
redis_url (str): The URL for the Redis server.
|
|
50
|
-
|
|
51
|
-
"""
|
|
52
|
-
self.seed = seed
|
|
53
|
-
self.cache = redis.Redis.from_url(redis_url)
|
|
54
|
-
|
|
55
|
-
def _prefixed_key(self, key: str) -> str:
|
|
56
|
-
"""
|
|
57
|
-
Get a namespaced key for the cache.
|
|
58
|
-
|
|
59
|
-
Args:
|
|
60
|
-
key (str): The original key.
|
|
61
|
-
|
|
62
|
-
Returns:
|
|
63
|
-
str: The namespaced key.
|
|
64
|
-
"""
|
|
65
|
-
return f"autogen:{self.seed}:{key}"
|
|
66
|
-
|
|
67
|
-
def get(self, key: str, default: Optional[Any] = None) -> Optional[Any]:
|
|
68
|
-
"""
|
|
69
|
-
Retrieve an item from the Redis cache.
|
|
70
|
-
|
|
71
|
-
Args:
|
|
72
|
-
key (str): The key identifying the item in the cache.
|
|
73
|
-
default (optional): The default value to return if the key is not found.
|
|
74
|
-
Defaults to None.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
The deserialized value associated with the key if found, else the default value.
|
|
78
|
-
"""
|
|
79
|
-
result = self.cache.get(self._prefixed_key(key))
|
|
80
|
-
if result is None:
|
|
81
|
-
return default
|
|
82
|
-
return pickle.loads(result)
|
|
83
|
-
|
|
84
|
-
def set(self, key: str, value: Any) -> None:
|
|
85
|
-
"""
|
|
86
|
-
Set an item in the Redis cache.
|
|
87
|
-
|
|
88
|
-
Args:
|
|
89
|
-
key (str): The key under which the item is to be stored.
|
|
90
|
-
value: The value to be stored in the cache.
|
|
91
|
-
|
|
92
|
-
Notes:
|
|
93
|
-
The value is serialized using pickle before being stored in Redis.
|
|
94
|
-
"""
|
|
95
|
-
serialized_value = pickle.dumps(value)
|
|
96
|
-
self.cache.set(self._prefixed_key(key), serialized_value)
|
|
97
|
-
|
|
98
|
-
def close(self) -> None:
|
|
99
|
-
"""
|
|
100
|
-
Close the Redis client.
|
|
101
|
-
|
|
102
|
-
Perform any necessary cleanup, such as closing network connections.
|
|
103
|
-
"""
|
|
104
|
-
self.cache.close()
|
|
105
|
-
|
|
106
|
-
def __enter__(self) -> Self:
|
|
107
|
-
"""
|
|
108
|
-
Enter the runtime context related to the object.
|
|
109
|
-
|
|
110
|
-
Returns:
|
|
111
|
-
self: The instance itself.
|
|
112
|
-
"""
|
|
113
|
-
return self
|
|
114
|
-
|
|
115
|
-
def __exit__(
|
|
116
|
-
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
|
117
|
-
) -> None:
|
|
118
|
-
"""
|
|
119
|
-
Exit the runtime context related to the object.
|
|
120
|
-
|
|
121
|
-
Perform cleanup actions such as closing the Redis client.
|
|
122
|
-
|
|
123
|
-
Args:
|
|
124
|
-
exc_type: The exception type if an exception was raised in the context.
|
|
125
|
-
exc_value: The exception value if an exception was raised in the context.
|
|
126
|
-
traceback: The traceback if an exception was raised in the context.
|
|
127
|
-
"""
|
|
128
|
-
self.close()
|