swarmauri-standard 0.6.0.dev4__tar.gz
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.
- swarmauri_standard-0.6.0.dev4/PKG-INFO +80 -0
- swarmauri_standard-0.6.0.dev4/README.md +38 -0
- swarmauri_standard-0.6.0.dev4/pyproject.toml +128 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/README.md +37 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/__init__.py +37 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/__version__.py +1 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/agents/QAAgent.py +19 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/agents/RagAgent.py +99 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/agents/SimpleConversationAgent.py +28 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/agents/ToolAgent.py +47 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/agents/__init__.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chains/CallableChain.py +29 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chains/ChainStep.py +8 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chains/ContextChain.py +48 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chains/PromptContextChain.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chains/__init__.py +15 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/DelimiterBasedChunker.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/FixedLengthChunker.py +32 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/MdSnippetChunker.py +44 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/SentenceChunker.py +31 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/SlidingWindowChunker.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/chunkers/__init__.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/control_panels/ControlPanel.py +10 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/control_panels/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/conversations/Conversation.py +8 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/conversations/MaxSizeConversation.py +25 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/conversations/MaxSystemContextConversation.py +83 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/conversations/SessionCacheConversation.py +81 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/conversations/__init__.py +22 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/dataconnectors/GoogleDriveDataConnector.py +341 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/dataconnectors/__init__.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/CanberraDistance.py +68 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/ChebyshevDistance.py +48 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/ChiSquaredDistance.py +39 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/CosineDistance.py +61 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/EuclideanDistance.py +50 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/HaversineDistance.py +50 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/JaccardIndexDistance.py +73 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/LevenshteinDistance.py +75 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/ManhattanDistance.py +49 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/MinkowskiDistance.py +64 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/SorensenDiceDistance.py +51 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/SquaredEuclideanDistance.py +47 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/distances/__init__.py +27 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/documents/Document.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/documents/__init__.py +11 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/CohereEmbedding.py +207 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/GeminiEmbedding.py +170 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/MistralEmbedding.py +134 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/NmfEmbedding.py +106 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/OpenAIEmbedding.py +141 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/TfidfEmbedding.py +52 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/VoyageEmbedding.py +115 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/embeddings/__init__.py +19 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/exceptions/IndexErrorWithContext.py +21 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/exceptions/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/factories/AgentFactory.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/factories/Factory.py +42 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/factories/__init__.py +14 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/BlackForestImgGenModel.py +259 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/DeepInfraImgGenModel.py +195 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/FalAIImgGenModel.py +322 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/HyperbolicImgGenModel.py +210 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/OpenAIImgGenModel.py +192 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/image_gens/__init__.py +0 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/AI21StudioModel.py +411 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/AnthropicModel.py +426 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/AnthropicToolModel.py +444 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/CohereModel.py +440 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/CohereToolModel.py +601 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/DeepInfraModel.py +407 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/DeepSeekModel.py +355 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/FalAIVisionModel.py +243 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GeminiProModel.py +452 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GeminiToolModel.py +582 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GroqAIAudio.py +200 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GroqModel.py +405 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GroqToolModel.py +471 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/GroqVisionModel.py +387 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/HyperbolicAudioTTS.py +146 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/HyperbolicModel.py +427 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/HyperbolicVisionModel.py +381 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/MistralModel.py +432 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/MistralToolModel.py +517 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/OpenAIAudio.py +192 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/OpenAIAudioTTS.py +224 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/OpenAIModel.py +468 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/OpenAIToolModel.py +444 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/PerplexityModel.py +492 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/PlayHTModel.py +352 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/WhisperLargeModel.py +217 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/llms/__init__.py +43 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/CompletenessMeasurement.py +79 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/DistinctivenessMeasurement.py +98 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/FirstImpressionMeasurement.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/MeanMeasurement.py +42 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/MiscMeasurement.py +176 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/MissingnessMeasurement.py +120 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/PatternMatchingMeasurement.py +31 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/RatioOfSumsMeasurement.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/StaticMeasurement.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/UniquenessMeasurement.py +96 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/ZeroMeasurement.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/measurements/__init__.py +41 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/messages/AgentMessage.py +25 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/messages/FunctionMessage.py +14 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/messages/HumanMessage.py +40 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/messages/SystemMessage.py +8 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/messages/__init__.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/BeautifulSoupElementParser.py +42 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/CSVParser.py +46 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/HTMLTagStripParser.py +38 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/KeywordExtractorParser.py +47 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/Md2HtmlParser.py +37 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/OpenAPISpecParser.py +44 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/PhoneNumberExtractorParser.py +34 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/PythonParser.py +54 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/RegExParser.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/URLExtractorParser.py +39 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/XMLParser.py +42 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/parsers/__init__.py +29 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/pipelines/Pipeline.py +50 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/pipelines/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/prompts/Prompt.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/prompts/PromptGenerator.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/prompts/PromptMatrix.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/prompts/PromptTemplate.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/prompts/__init__.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/AnthropicSchemaConverter.py +29 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/CohereSchemaConverter.py +33 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/GeminiSchemaConverter.py +72 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/GroqSchemaConverter.py +38 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/MistralSchemaConverter.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/OpenAISchemaConverter.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/ShuttleAISchemaConverter.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/schema_converters/__init__.py +37 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/service_registries/ServiceRegistry.py +10 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/service_registries/__init__.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/state/DictState.py +50 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/state/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/swarms/Swarm.py +36 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/swarms/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/task_mgt_strategies/RoundRobinStrategy.py +73 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/task_mgt_strategies/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/toolkits/AccessibilityToolkit.py +47 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/toolkits/Toolkit.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/toolkits/__init__.py +14 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/AdditionTool.py +39 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/AutomatedReadabilityIndexTool.py +123 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/CalculatorTool.py +56 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/CodeExtractorTool.py +140 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/CodeInterpreterTool.py +69 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/ColemanLiauIndexTool.py +125 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/FleschKincaidTool.py +172 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/FleschReadingEaseTool.py +103 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/GunningFogTool.py +152 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/ImportMemoryModuleTool.py +96 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/JSONRequestsTool.py +190 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/MatplotlibCsvTool.py +84 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/MatplotlibTool.py +121 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/Parameter.py +10 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/RequestsTool.py +182 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/SentenceComplexityTool.py +84 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/TemperatureConverterTool.py +70 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/TestTool.py +34 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/WeatherTool.py +38 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tools/__init__.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/CallableTracer.py +32 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/ChainTracer.py +51 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/SimpleTraceContext.py +21 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/SimpleTracer.py +40 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/TracedVariable.py +28 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/VariableTracer.py +23 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/tracing/__init__.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/transports/PubSubTransport.py +118 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/transports/__init__.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/LazyLoader.py +37 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/__init__.py +0 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/_get_subclasses.py +72 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/_lazy_import.py +22 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/apply_metaclass.py +4 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/base64_encoder.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/base64_to_file_path.py +9 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/base64_to_img_url.py +44 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/base64_to_in_memory_img.py +9 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/decorate.py +24 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/duration_manager.py +13 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/file_path_to_base64.py +10 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/file_path_to_img_url.py +45 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/file_path_to_in_memory_img.py +6 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/get_class_hash.py +35 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/img_url_to_base64.py +12 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/img_url_to_file_path.py +8 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/img_url_to_in_memory_img.py +9 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/in_memory_img_to_base64.py +9 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/in_memory_img_to_file_path.py +4 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/in_memory_img_to_img_url.py +50 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/json_validator.py +17 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/load_documents_from_folder.py +58 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/load_documents_from_json.py +28 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/memoize.py +16 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/method_signature_extractor_decorator.py +113 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/print_notebook_metadata.py +82 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/retry_decorator.py +94 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/sql_log.py +76 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/utils/timeout_wrapper.py +42 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/vector_stores/SqliteVectorStore.py +173 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/vector_stores/TfidfVectorStore.py +74 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/vector_stores/__init__.py +14 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/vectors/Vector.py +5 -0
- swarmauri_standard-0.6.0.dev4/swarmauri_standard/vectors/__init__.py +14 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: swarmauri-standard
|
|
3
|
+
Version: 0.6.0.dev4
|
|
4
|
+
Summary: This repository includes standard components within the Swarmauri framework.
|
|
5
|
+
Home-page: http://github.com/swarmauri/swarmauri-sdk
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Author: Jacob Stewart
|
|
8
|
+
Author-email: jacob@swarmauri.com
|
|
9
|
+
Requires-Python: >=3.10,<3.13
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Provides-Extra: full
|
|
16
|
+
Provides-Extra: io
|
|
17
|
+
Provides-Extra: ml-toolkits
|
|
18
|
+
Provides-Extra: nlp
|
|
19
|
+
Provides-Extra: nlp-tools
|
|
20
|
+
Provides-Extra: visualization
|
|
21
|
+
Requires-Dist: Pillow (>=8.0,<11.0)
|
|
22
|
+
Requires-Dist: aiofiles (==24.1.0) ; extra == "io" or extra == "full"
|
|
23
|
+
Requires-Dist: aiohttp (>=3.10.10,<4.0.0) ; extra == "io" or extra == "full"
|
|
24
|
+
Requires-Dist: beautifulsoup4 (==04.12.3) ; extra == "nlp-tools" or extra == "full"
|
|
25
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
26
|
+
Requires-Dist: joblib (>=1.4.0,<2.0.0)
|
|
27
|
+
Requires-Dist: matplotlib (>=3.9.2) ; extra == "visualization" or extra == "full"
|
|
28
|
+
Requires-Dist: numpy
|
|
29
|
+
Requires-Dist: pandas
|
|
30
|
+
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
|
|
31
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
32
|
+
Requires-Dist: scikit-learn (>=1.4.2,<2.0.0) ; extra == "ml-toolkits" or extra == "full"
|
|
33
|
+
Requires-Dist: scipy (>=1.7.0,<1.14.0)
|
|
34
|
+
Requires-Dist: swarmauri_base (>=0.6.0.dev4,<0.7.0)
|
|
35
|
+
Requires-Dist: swarmauri_core (>=0.6.0.dev4,<0.7.0)
|
|
36
|
+
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
37
|
+
Requires-Dist: typing_extensions
|
|
38
|
+
Requires-Dist: yake (==0.4.8) ; extra == "nlp" or extra == "full"
|
|
39
|
+
Project-URL: Repository, http://github.com/swarmauri/swarmauri-sdk
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# Swarmauri SDK
|
|
43
|
+
|
|
44
|
+
The Swarmauri SDK offers a comprehensive suite of tools designed for building distributed, extensible systems using the Swarmauri framework.
|
|
45
|
+
|
|
46
|
+
## Core
|
|
47
|
+
- **Core Interfaces**: Define the fundamental communication and data-sharing protocols between components in a Swarmauri-based system.
|
|
48
|
+
|
|
49
|
+
## Standard
|
|
50
|
+
- **Base Classes**: Provide a foundation for constructing Swarmauri components, with standardized methods and properties.
|
|
51
|
+
- **Mixins**: Reusable code fragments designed to be integrated into various classes, offering shared functionality across different components.
|
|
52
|
+
- **Concrete Classes**: Ready-to-use, pre-implemented classes that fulfill standard system needs while adhering to Swarmauri principles. **These classes are the first in line for ongoing support and maintenance, ensuring they remain stable, performant, and up to date with future SDK developments.**
|
|
53
|
+
|
|
54
|
+
## Community
|
|
55
|
+
- **Third-Party Plug-in Integration**: Concrete classes designed to extend the framework’s capabilities by utilizing third-party libraries and plugins.
|
|
56
|
+
- **Open Source Contributions**: A collaborative space for developers to contribute new components, plug-ins, and features.
|
|
57
|
+
|
|
58
|
+
## Experimental
|
|
59
|
+
- **In-Development Components**: Early-stage features and components that push the boundaries of the Swarmauri framework, offering innovative solutions that are still in testing phases.
|
|
60
|
+
|
|
61
|
+
# Features
|
|
62
|
+
|
|
63
|
+
- **Polymorphism**: Allows for dynamic behavior switching between components, enabling flexible, context-aware system behavior.
|
|
64
|
+
- **Discriminated Unions**: Provides a robust method for handling multiple possible object types in a type-safe manner.
|
|
65
|
+
- **Serialization**: Efficiently encode and decode data for transmission across different environments and system components, with support for both standard and custom serialization formats.
|
|
66
|
+
- **Intensional and Extensional Programming**: Leverages both rule-based (intensional) and set-based (extensional) approaches to building and manipulating complex data structures, offering developers a wide range of tools for system design.
|
|
67
|
+
|
|
68
|
+
## Use Cases
|
|
69
|
+
|
|
70
|
+
- **Modular Systems**: Develop scalable, pluggable systems that can evolve over time by adding or modifying components without disrupting the entire ecosystem.
|
|
71
|
+
- **Distributed Architectures**: Build systems with distributed nodes that seamlessly communicate using the SDK’s standardized interfaces.
|
|
72
|
+
- **Third-Party Integrations**: Extend the system's capabilities by easily incorporating third-party tools, libraries, and services.
|
|
73
|
+
- **Prototype and Experimentation**: Test cutting-edge ideas using the experimental components in the SDK, while retaining the reliability of core and standard features for production systems.
|
|
74
|
+
|
|
75
|
+
# Future Development
|
|
76
|
+
|
|
77
|
+
The Swarmauri SDK is an evolving platform, and the community is encouraged to contribute to its growth. Upcoming releases will focus on enhancing the framework's modularity, providing more advanced serialization methods, and expanding the community-driven component library.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Swarmauri SDK
|
|
2
|
+
|
|
3
|
+
The Swarmauri SDK offers a comprehensive suite of tools designed for building distributed, extensible systems using the Swarmauri framework.
|
|
4
|
+
|
|
5
|
+
## Core
|
|
6
|
+
- **Core Interfaces**: Define the fundamental communication and data-sharing protocols between components in a Swarmauri-based system.
|
|
7
|
+
|
|
8
|
+
## Standard
|
|
9
|
+
- **Base Classes**: Provide a foundation for constructing Swarmauri components, with standardized methods and properties.
|
|
10
|
+
- **Mixins**: Reusable code fragments designed to be integrated into various classes, offering shared functionality across different components.
|
|
11
|
+
- **Concrete Classes**: Ready-to-use, pre-implemented classes that fulfill standard system needs while adhering to Swarmauri principles. **These classes are the first in line for ongoing support and maintenance, ensuring they remain stable, performant, and up to date with future SDK developments.**
|
|
12
|
+
|
|
13
|
+
## Community
|
|
14
|
+
- **Third-Party Plug-in Integration**: Concrete classes designed to extend the framework’s capabilities by utilizing third-party libraries and plugins.
|
|
15
|
+
- **Open Source Contributions**: A collaborative space for developers to contribute new components, plug-ins, and features.
|
|
16
|
+
|
|
17
|
+
## Experimental
|
|
18
|
+
- **In-Development Components**: Early-stage features and components that push the boundaries of the Swarmauri framework, offering innovative solutions that are still in testing phases.
|
|
19
|
+
|
|
20
|
+
# Features
|
|
21
|
+
|
|
22
|
+
- **Polymorphism**: Allows for dynamic behavior switching between components, enabling flexible, context-aware system behavior.
|
|
23
|
+
- **Discriminated Unions**: Provides a robust method for handling multiple possible object types in a type-safe manner.
|
|
24
|
+
- **Serialization**: Efficiently encode and decode data for transmission across different environments and system components, with support for both standard and custom serialization formats.
|
|
25
|
+
- **Intensional and Extensional Programming**: Leverages both rule-based (intensional) and set-based (extensional) approaches to building and manipulating complex data structures, offering developers a wide range of tools for system design.
|
|
26
|
+
|
|
27
|
+
## Use Cases
|
|
28
|
+
|
|
29
|
+
- **Modular Systems**: Develop scalable, pluggable systems that can evolve over time by adding or modifying components without disrupting the entire ecosystem.
|
|
30
|
+
- **Distributed Architectures**: Build systems with distributed nodes that seamlessly communicate using the SDK’s standardized interfaces.
|
|
31
|
+
- **Third-Party Integrations**: Extend the system's capabilities by easily incorporating third-party tools, libraries, and services.
|
|
32
|
+
- **Prototype and Experimentation**: Test cutting-edge ideas using the experimental components in the SDK, while retaining the reliability of core and standard features for production systems.
|
|
33
|
+
|
|
34
|
+
# Future Development
|
|
35
|
+
|
|
36
|
+
The Swarmauri SDK is an evolving platform, and the community is encouraged to contribute to its growth. Upcoming releases will focus on enhancing the framework's modularity, providing more advanced serialization methods, and expanding the community-driven component library.
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "swarmauri-standard"
|
|
3
|
+
version = "0.6.0.dev4"
|
|
4
|
+
description = "This repository includes standard components within the Swarmauri framework."
|
|
5
|
+
authors = ["Jacob Stewart <jacob@swarmauri.com>"]
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
repository = "http://github.com/swarmauri/swarmauri-sdk"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"License :: OSI Approved :: Apache Software License",
|
|
11
|
+
"Programming Language :: Python :: 3.10",
|
|
12
|
+
"Programming Language :: Python :: 3.11",
|
|
13
|
+
"Programming Language :: Python :: 3.12"
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[tool.poetry.dependencies]
|
|
17
|
+
python = ">=3.10,<3.13"
|
|
18
|
+
|
|
19
|
+
# Swarmauri
|
|
20
|
+
swarmauri_core = "^0.6.0.dev4"
|
|
21
|
+
swarmauri_base = "^0.6.0.dev4"
|
|
22
|
+
|
|
23
|
+
# Dependencies
|
|
24
|
+
toml = "^0.10.2"
|
|
25
|
+
httpx = "^0.27.0"
|
|
26
|
+
joblib = "^1.4.0"
|
|
27
|
+
numpy = "*"
|
|
28
|
+
pandas = "*"
|
|
29
|
+
pydantic = "^2.9.2"
|
|
30
|
+
typing_extensions = "*"
|
|
31
|
+
|
|
32
|
+
# We should remove and only rely on httpx
|
|
33
|
+
requests = "^2.32.3"
|
|
34
|
+
|
|
35
|
+
# This should be set to optional also
|
|
36
|
+
Pillow = ">=8.0,<11.0"
|
|
37
|
+
|
|
38
|
+
# Optional dependencies with versions specified
|
|
39
|
+
aiofiles = { version = "24.1.0", optional = true }
|
|
40
|
+
aiohttp = { version = "^3.10.10", optional = true }
|
|
41
|
+
#cohere = { version = "^5.11.0", optional = true }
|
|
42
|
+
#mistralai = { version = "^1.2.1", optional = true }
|
|
43
|
+
#fal-client = { version = ">=0.5.0", optional = true }
|
|
44
|
+
#google-generativeai = { version = "^0.8.3", optional = true }
|
|
45
|
+
#openai = { version = "^1.52.0", optional = true }
|
|
46
|
+
#nltk = { version = "^3.9.1", optional = true }
|
|
47
|
+
#textblob = { version = "^0.18.0", optional = true }
|
|
48
|
+
yake = { version = "==0.4.8", optional = true }
|
|
49
|
+
beautifulsoup4 = { version = "04.12.3", optional = true }
|
|
50
|
+
#gensim = { version = "==4.3.3", optional = true }
|
|
51
|
+
scipy = { version = ">=1.7.0,<1.14.0", optional = true }
|
|
52
|
+
scikit-learn = { version = "^1.4.2", optional = true }
|
|
53
|
+
#spacy = { version = ">=3.0.0,<=3.8.2", optional = true }
|
|
54
|
+
#transformers = { version = "^4.45.0", optional = true }
|
|
55
|
+
#torch = { version = "^2.5.0", optional = true }
|
|
56
|
+
#keras = { version = ">=3.2.0", optional = true }
|
|
57
|
+
#tf-keras = { version = ">=2.16.0", optional = true }
|
|
58
|
+
matplotlib = { version = ">=3.9.2", optional = true }
|
|
59
|
+
|
|
60
|
+
[tool.poetry.extras]
|
|
61
|
+
# Extras without versioning, grouped for specific use cases
|
|
62
|
+
io = ["aiofiles", "aiohttp"]
|
|
63
|
+
#llms = ["cohere", "mistralai", "fal-client", "google-generativeai", "openai"]
|
|
64
|
+
nlp = [
|
|
65
|
+
#"nltk",
|
|
66
|
+
#"textblob",
|
|
67
|
+
"yake"
|
|
68
|
+
]
|
|
69
|
+
nlp_tools = ["beautifulsoup4"]
|
|
70
|
+
#ml_toolkits = ["gensim", "scipy", "scikit-learn"]
|
|
71
|
+
ml_toolkits = ["scikit-learn"]
|
|
72
|
+
#spacy = ["spacy"]
|
|
73
|
+
#transformers = ["transformers"]
|
|
74
|
+
#torch = ["torch"]
|
|
75
|
+
#tensorflow = ["keras", "tf-keras"]
|
|
76
|
+
visualization = ["matplotlib"]
|
|
77
|
+
|
|
78
|
+
# Full option to install all extras
|
|
79
|
+
full = [
|
|
80
|
+
"aiofiles", "aiohttp",
|
|
81
|
+
#"cohere", "mistralai", "fal-client", "google-generativeai", "openai",
|
|
82
|
+
#"nltk", "textblob",
|
|
83
|
+
"yake",
|
|
84
|
+
"beautifulsoup4",
|
|
85
|
+
"scikit-learn",
|
|
86
|
+
#"gensim", "scipy", "scikit-learn",
|
|
87
|
+
#"spacy",
|
|
88
|
+
#"transformers",
|
|
89
|
+
#"torch",
|
|
90
|
+
#"keras", "tf-keras",
|
|
91
|
+
"matplotlib"
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
[tool.poetry.dev-dependencies]
|
|
95
|
+
flake8 = "^7.0"
|
|
96
|
+
pytest = "^8.0"
|
|
97
|
+
pytest-asyncio = ">=0.24.0"
|
|
98
|
+
pytest-timeout = "^2.3.1"
|
|
99
|
+
pytest-xdist = "^3.6.1"
|
|
100
|
+
pytest-json-report = "^1.5.0"
|
|
101
|
+
python-dotenv = "^1.0.0"
|
|
102
|
+
jsonschema = "^4.18.5"
|
|
103
|
+
ipython = "^8.28.0"
|
|
104
|
+
requests = "^2.32.3"
|
|
105
|
+
|
|
106
|
+
[build-system]
|
|
107
|
+
requires = ["poetry-core>=1.0.0"]
|
|
108
|
+
build-backend = "poetry.core.masonry.api"
|
|
109
|
+
|
|
110
|
+
[tool.pytest.ini_options]
|
|
111
|
+
norecursedirs = ["combined", "scripts"]
|
|
112
|
+
asyncio_mode = "auto"
|
|
113
|
+
|
|
114
|
+
markers = [
|
|
115
|
+
"test: standard test",
|
|
116
|
+
"unit: Unit tests",
|
|
117
|
+
"integration: Integration tests",
|
|
118
|
+
"acceptance: Acceptance tests",
|
|
119
|
+
"experimental: Experimental tests",
|
|
120
|
+
"timeout: mark test to timeout after X seconds",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
log_cli = true
|
|
124
|
+
log_cli_level = "INFO"
|
|
125
|
+
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
126
|
+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
127
|
+
|
|
128
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Standard Library
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
The Standard Library extends the Core Library with concrete implementations of models, agents, tools, parsers, and more. It aims to provide ready-to-use components that can be easily integrated into machine learning projects.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Predefined Models and Agents**: Implements standard models and agents ready for use.
|
|
9
|
+
- **Toolkit**: A collection of tools for various tasks (e.g., weather information, math operations).
|
|
10
|
+
- **Parsers Implementations**: Various parsers for text data, including HTML and CSV parsers.
|
|
11
|
+
- **Conversations and Chunkers**: Manage conversation histories and chunk text data.
|
|
12
|
+
- **Vectorizers**: Transform text data into vector representations.
|
|
13
|
+
- **Document Stores and Vector Stores**: Concrete implementations for storing and retrieving data.
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
To make the best use of the Standard Library, first ensure that the Core Library is set up in your project as the Standard Library builds upon it.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
# Example usage of a concrete model from the Standard Library
|
|
21
|
+
from swarmauri.standard.models.concrete import OpenAIModel
|
|
22
|
+
|
|
23
|
+
# Initialize the model with necessary configuration
|
|
24
|
+
model = OpenAIModel(api_key="your_api_key_here")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
For more detailed guides and API documentation, check the [Docs](/docs) directory within the library. You'll find examples, configuration options, and best practices for utilizing the provided components.
|
|
30
|
+
|
|
31
|
+
## Contributing
|
|
32
|
+
|
|
33
|
+
Your contributions can help the Standard Library grow! Whether it's adding new tools, improving models, or writing documentation, we appreciate your help. Please send a pull request with your contributions.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
Please see the `LICENSE` file in the repository for details.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
__long_desc__ = """
|
|
2
|
+
# Swarmauri Standard SDK
|
|
3
|
+
|
|
4
|
+
The Swarmauri Standard SDK offers a comprehensive suite of tools designed for building distributed, extensible systems using the Swarmauri framework.
|
|
5
|
+
|
|
6
|
+
## Standard
|
|
7
|
+
- **Base Classes**: Provide a foundation for constructing Swarmauri components, with standardized methods and properties.
|
|
8
|
+
- **Mixins**: Reusable code fragments designed to be integrated into various classes, offering shared functionality across different components.
|
|
9
|
+
- **Concrete Classes**: Ready-to-use, pre-implemented classes that fulfill standard system needs while adhering to Swarmauri principles. **These classes are the first in line for ongoing support and maintenance, ensuring they remain stable, performant, and up to date with future SDK developments.**
|
|
10
|
+
|
|
11
|
+
# Features
|
|
12
|
+
|
|
13
|
+
- **Polymorphism**: Allows for dynamic behavior switching between components, enabling flexible, context-aware system behavior.
|
|
14
|
+
- **Discriminated Unions**: Provides a robust method for handling multiple possible object types in a type-safe manner.
|
|
15
|
+
- **Serialization**: Efficiently encode and decode data for transmission across different environments and system components, with support for both standard and custom serialization formats.
|
|
16
|
+
- **Intensional and Extensional Programming**: Leverages both rule-based (intensional) and set-based (extensional) approaches to building and manipulating complex data structures, offering developers a wide range of tools for system design.
|
|
17
|
+
|
|
18
|
+
## Use Cases
|
|
19
|
+
|
|
20
|
+
- **Modular Systems**: Develop scalable, pluggable systems that can evolve over time by adding or modifying components without disrupting the entire ecosystem.
|
|
21
|
+
- **Distributed Architectures**: Build systems with distributed nodes that seamlessly communicate using the SDK’s standardized interfaces.
|
|
22
|
+
- **Third-Party Integrations**: Extend the system's capabilities by easily incorporating third-party tools, libraries, and services.
|
|
23
|
+
- **Prototype and Experimentation**: Test cutting-edge ideas using the experimental components in the SDK, while retaining the reliability of core and standard features for production systems.
|
|
24
|
+
|
|
25
|
+
# Future Development
|
|
26
|
+
|
|
27
|
+
The Swarmauri SDK is an evolving platform, and the community is encouraged to contribute to its growth. Upcoming releases will focus on enhancing the framework's modularity, providing more advanced serialization methods, and expanding the community-driven component library.
|
|
28
|
+
|
|
29
|
+
Visit us at: https://swarmauri.com
|
|
30
|
+
Follow us at: https://github.com/swarmauri
|
|
31
|
+
"""
|
|
32
|
+
from .__version__ import __version__
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"__version__",
|
|
36
|
+
# other packages you want to expose
|
|
37
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.2.dev1"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Any, Optional, Dict, Literal
|
|
2
|
+
from swarmauri_base.agents.AgentBase import AgentBase
|
|
3
|
+
from swarmauri.conversations.concrete.MaxSystemContextConversation import MaxSystemContextConversation
|
|
4
|
+
from swarmauri.messages.concrete.HumanMessage import HumanMessage
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class QAAgent(AgentBase):
|
|
8
|
+
conversation: MaxSystemContextConversation = MaxSystemContextConversation(max_size=2)
|
|
9
|
+
type: Literal['QAAgent'] = 'QAAgent'
|
|
10
|
+
|
|
11
|
+
def exec(self,
|
|
12
|
+
input_str: Optional[str] = "",
|
|
13
|
+
llm_kwargs: Optional[Dict] = {}
|
|
14
|
+
) -> Any:
|
|
15
|
+
|
|
16
|
+
self.conversation.add_message(HumanMessage(content=input_str))
|
|
17
|
+
self.llm.predict(conversation=self.conversation, **llm_kwargs)
|
|
18
|
+
|
|
19
|
+
return self.conversation.get_last().content
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from typing import Any, Optional, Union, Dict, Literal
|
|
2
|
+
from swarmauri_core.messages import IMessage
|
|
3
|
+
|
|
4
|
+
from swarmauri_base.agents.AgentBase import AgentBase
|
|
5
|
+
from swarmauri_base.agents.AgentRetrieveMixin import AgentRetrieveMixin
|
|
6
|
+
from swarmauri_base.agents.AgentConversationMixin import AgentConversationMixin
|
|
7
|
+
from swarmauri_base.agents.AgentVectorStoreMixin import AgentVectorStoreMixin
|
|
8
|
+
from swarmauri_base.agents.AgentSystemContextMixin import AgentSystemContextMixin
|
|
9
|
+
|
|
10
|
+
from swarmauri.messages.concrete import (HumanMessage,
|
|
11
|
+
SystemMessage,
|
|
12
|
+
AgentMessage)
|
|
13
|
+
|
|
14
|
+
from swarmauri_core.typing import SubclassUnion
|
|
15
|
+
from swarmauri_base.llms.LLMBase import LLMBase
|
|
16
|
+
from swarmauri_base.conversations.ConversationBase import ConversationBase
|
|
17
|
+
from swarmauri_base.vector_stores.VectorStoreBase import VectorStoreBase
|
|
18
|
+
|
|
19
|
+
class RagAgent(AgentRetrieveMixin,
|
|
20
|
+
AgentVectorStoreMixin,
|
|
21
|
+
AgentSystemContextMixin,
|
|
22
|
+
AgentConversationMixin,
|
|
23
|
+
AgentBase):
|
|
24
|
+
"""
|
|
25
|
+
RagAgent (Retriever-And-Generator Agent) extends DocumentAgentBase,
|
|
26
|
+
specialized in retrieving documents based on input queries and generating responses.
|
|
27
|
+
"""
|
|
28
|
+
llm: SubclassUnion[LLMBase]
|
|
29
|
+
conversation: SubclassUnion[ConversationBase]
|
|
30
|
+
vector_store: SubclassUnion[VectorStoreBase]
|
|
31
|
+
system_context: Union[SystemMessage, str]
|
|
32
|
+
type: Literal['RagAgent'] = 'RagAgent'
|
|
33
|
+
|
|
34
|
+
def _create_preamble_context(self):
|
|
35
|
+
substr = self.system_context.content
|
|
36
|
+
substr += '\n\n'
|
|
37
|
+
substr += '\n'.join([doc.content for doc in self.last_retrieved])
|
|
38
|
+
return substr
|
|
39
|
+
|
|
40
|
+
def _create_post_context(self):
|
|
41
|
+
substr = '\n'.join([doc.content for doc in self.last_retrieved])
|
|
42
|
+
substr += '\n\n'
|
|
43
|
+
substr += self.system_context.content
|
|
44
|
+
return substr
|
|
45
|
+
|
|
46
|
+
def exec(self,
|
|
47
|
+
input_data: Optional[Union[str, IMessage]] = "",
|
|
48
|
+
top_k: int = 5,
|
|
49
|
+
preamble: bool = True,
|
|
50
|
+
fixed: bool = False,
|
|
51
|
+
llm_kwargs: Optional[Dict] = {}
|
|
52
|
+
) -> Any:
|
|
53
|
+
try:
|
|
54
|
+
# Check if the input is a string, then wrap it in a HumanMessage
|
|
55
|
+
if isinstance(input_data, str):
|
|
56
|
+
human_message = HumanMessage(content=input_data)
|
|
57
|
+
elif isinstance(input_data, IMessage):
|
|
58
|
+
human_message = input_data
|
|
59
|
+
else:
|
|
60
|
+
raise TypeError("Input data must be a string or an instance of Message.")
|
|
61
|
+
|
|
62
|
+
# Add the human message to the conversation
|
|
63
|
+
self.conversation.add_message(human_message)
|
|
64
|
+
|
|
65
|
+
# Retrieval and set new substr for system context
|
|
66
|
+
if top_k > 0 and len(self.vector_store.documents) > 0:
|
|
67
|
+
self.last_retrieved = self.vector_store.retrieve(query=input_data, top_k=top_k)
|
|
68
|
+
|
|
69
|
+
if preamble:
|
|
70
|
+
substr = self._create_preamble_context()
|
|
71
|
+
else:
|
|
72
|
+
substr = self._create_post_context()
|
|
73
|
+
|
|
74
|
+
else:
|
|
75
|
+
if fixed:
|
|
76
|
+
if preamble:
|
|
77
|
+
substr = self._create_preamble_context()
|
|
78
|
+
else:
|
|
79
|
+
substr = self._create_post_context()
|
|
80
|
+
else:
|
|
81
|
+
substr = self.system_context.content
|
|
82
|
+
self.last_retrieved = []
|
|
83
|
+
|
|
84
|
+
# Use substr to set system context
|
|
85
|
+
system_context = SystemMessage(content=substr)
|
|
86
|
+
self.conversation.system_context = system_context
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Retrieve the conversation history and predict a response
|
|
90
|
+
if llm_kwargs:
|
|
91
|
+
self.llm.predict(conversation=self.conversation, **llm_kwargs)
|
|
92
|
+
else:
|
|
93
|
+
self.llm.predict(conversation=self.conversation)
|
|
94
|
+
|
|
95
|
+
return self.conversation.get_last().content
|
|
96
|
+
|
|
97
|
+
except Exception as e:
|
|
98
|
+
print(f"RagAgent error: {e}")
|
|
99
|
+
raise e
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import Any, Optional, Dict, Literal, List, Union
|
|
2
|
+
|
|
3
|
+
from swarmauri_base.agents.AgentBase import AgentBase
|
|
4
|
+
from swarmauri_base.agents.AgentConversationMixin import AgentConversationMixin
|
|
5
|
+
from swarmauri.messages.concrete import HumanMessage
|
|
6
|
+
|
|
7
|
+
from swarmauri_core.typing import SubclassUnion
|
|
8
|
+
from swarmauri_base.conversations.ConversationBase import ConversationBase
|
|
9
|
+
|
|
10
|
+
from swarmauri.messages.concrete.HumanMessage import contentItem
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SimpleConversationAgent(AgentConversationMixin, AgentBase):
|
|
14
|
+
conversation: SubclassUnion[ConversationBase] #
|
|
15
|
+
type: Literal["SimpleConversationAgent"] = "SimpleConversationAgent"
|
|
16
|
+
|
|
17
|
+
def exec(
|
|
18
|
+
self,
|
|
19
|
+
input_data: Optional[Union[str, List[contentItem]]] = "",
|
|
20
|
+
llm_kwargs: Optional[Dict] = {},
|
|
21
|
+
) -> Any:
|
|
22
|
+
|
|
23
|
+
if input_str:
|
|
24
|
+
human_message = HumanMessage(content=input_str)
|
|
25
|
+
self.conversation.add_message(human_message)
|
|
26
|
+
|
|
27
|
+
self.llm.predict(conversation=self.conversation, **llm_kwargs)
|
|
28
|
+
return self.conversation.get_last().content
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from pydantic import ConfigDict
|
|
2
|
+
from typing import Any, Optional, Union, Dict, Literal
|
|
3
|
+
import json
|
|
4
|
+
import logging
|
|
5
|
+
from swarmauri_core.messages import IMessage
|
|
6
|
+
|
|
7
|
+
from swarmauri_base.llms.LLMBase import LLMBase
|
|
8
|
+
from swarmauri_base.agents.AgentBase import AgentBase
|
|
9
|
+
from swarmauri_base.agents.AgentConversationMixin import AgentConversationMixin
|
|
10
|
+
from swarmauri_base.agents.AgentToolMixin import AgentToolMixin
|
|
11
|
+
from swarmauri.messages.concrete import HumanMessage, AgentMessage, FunctionMessage
|
|
12
|
+
|
|
13
|
+
from swarmauri_core.typing import SubclassUnion
|
|
14
|
+
from swarmauri_base.toolkits.ToolkitBase import ToolkitBase
|
|
15
|
+
from swarmauri_base.conversations.ConversationBase import ConversationBase
|
|
16
|
+
|
|
17
|
+
class ToolAgent(AgentToolMixin, AgentConversationMixin, AgentBase):
|
|
18
|
+
llm: SubclassUnion[LLMBase]
|
|
19
|
+
toolkit: SubclassUnion[ToolkitBase]
|
|
20
|
+
conversation: SubclassUnion[ConversationBase] # 🚧 Placeholder
|
|
21
|
+
model_config = ConfigDict(extra='forbid', arbitrary_types_allowed=True)
|
|
22
|
+
type: Literal['ToolAgent'] = 'ToolAgent'
|
|
23
|
+
|
|
24
|
+
def exec(self,
|
|
25
|
+
input_data: Optional[Union[str, IMessage]] = "",
|
|
26
|
+
llm_kwargs: Optional[Dict] = {}) -> Any:
|
|
27
|
+
|
|
28
|
+
# Check if the input is a string, then wrap it in a HumanMessage
|
|
29
|
+
if isinstance(input_data, str):
|
|
30
|
+
human_message = HumanMessage(content=input_data)
|
|
31
|
+
elif isinstance(input_data, IMessage):
|
|
32
|
+
human_message = input_data
|
|
33
|
+
else:
|
|
34
|
+
raise TypeError("Input data must be a string or an instance of Message.")
|
|
35
|
+
|
|
36
|
+
# Add the human message to the conversation
|
|
37
|
+
self.conversation.add_message(human_message)
|
|
38
|
+
|
|
39
|
+
#predict a response
|
|
40
|
+
self.conversation = self.llm.predict(
|
|
41
|
+
conversation=self.conversation,
|
|
42
|
+
toolkit=self.toolkit,
|
|
43
|
+
**llm_kwargs)
|
|
44
|
+
|
|
45
|
+
logging.info(self.conversation.get_last().content)
|
|
46
|
+
|
|
47
|
+
return self.conversation.get_last().content
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from swarmauri.utils._lazy_import import _lazy_import
|
|
2
|
+
|
|
3
|
+
# List of agent names (file names without the ".py" extension) and corresponding class names
|
|
4
|
+
agent_files = [
|
|
5
|
+
("swarmauri.agents.concrete.QAAgent", "QAAgent"),
|
|
6
|
+
("swarmauri.agents.concrete.RagAgent", "RagAgent"),
|
|
7
|
+
("swarmauri.agents.concrete.SimpleConversationAgent", "SimpleConversationAgent"),
|
|
8
|
+
("swarmauri.agents.concrete.ToolAgent", "ToolAgent"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
# Lazy loading of agent classes, storing them in variables
|
|
12
|
+
for module_name, class_name in agent_files:
|
|
13
|
+
globals()[class_name] = _lazy_import(module_name, class_name)
|
|
14
|
+
|
|
15
|
+
# Adding the lazy-loaded agent classes to __all__
|
|
16
|
+
__all__ = [class_name for _, class_name in agent_files]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Any, Callable, List, Dict, Optional
|
|
2
|
+
from swarmauri_core.chains.ICallableChain import ICallableChain, CallableDefinition
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CallableChain(ICallableChain):
|
|
6
|
+
|
|
7
|
+
def __init__(self, callables: Optional[List[CallableDefinition]] = None):
|
|
8
|
+
|
|
9
|
+
self.callables = callables if callables is not None else []
|
|
10
|
+
|
|
11
|
+
def __call__(self, *initial_args, **initial_kwargs):
|
|
12
|
+
result = None
|
|
13
|
+
for func, args, kwargs in self.callables:
|
|
14
|
+
if result is not None:
|
|
15
|
+
# If there was a previous result, use it as the first argument for the next function
|
|
16
|
+
args = [result] + list(args)
|
|
17
|
+
result = func(*args, **kwargs)
|
|
18
|
+
return result
|
|
19
|
+
|
|
20
|
+
def add_callable(self, func: Callable[[Any], Any], args: List[Any] = None, kwargs: Dict[str, Any] = None) -> None:
|
|
21
|
+
# Add a new callable to the chain
|
|
22
|
+
self.callables.append((func, args or [], kwargs or {}))
|
|
23
|
+
|
|
24
|
+
def __or__(self, other: "CallableChain") -> "CallableChain":
|
|
25
|
+
if not isinstance(other, CallableChain):
|
|
26
|
+
raise TypeError("Operand must be an instance of CallableChain")
|
|
27
|
+
|
|
28
|
+
new_chain = CallableChain(self.callables + other.callables)
|
|
29
|
+
return new_chain
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Callable, Optional, Tuple, Union, Literal
|
|
2
|
+
from swarmauri_core.typing import SubclassUnion
|
|
3
|
+
from swarmauri_base.tools.ToolBase import ToolBase
|
|
4
|
+
from swarmauri.chains.concrete.ChainStep import ChainStep
|
|
5
|
+
from swarmauri_base.chains.ChainContextBase import ChainContextBase
|
|
6
|
+
from swarmauri_core.chains.IChain import IChain
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ContextChain(IChain, ChainContextBase):
|
|
10
|
+
"""
|
|
11
|
+
Enhanced to support ChainSteps with return parameters, storing return values as instance state variables.
|
|
12
|
+
Implements the IChain interface including get_schema_info and remove_step methods.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
type: Literal["ContextChain"] = "ContextChain"
|
|
16
|
+
|
|
17
|
+
def add_step(
|
|
18
|
+
self,
|
|
19
|
+
key: str,
|
|
20
|
+
method: SubclassUnion[ToolBase],
|
|
21
|
+
args: Tuple = (),
|
|
22
|
+
kwargs: Dict[str, Any] = {},
|
|
23
|
+
ref: Optional[str] = None,
|
|
24
|
+
):
|
|
25
|
+
# Directly store args, kwargs, and optionally a return_key without resolving them
|
|
26
|
+
step = ChainStep(key=key, method=method, args=args, kwargs=kwargs, ref=ref)
|
|
27
|
+
self.steps.append(step)
|
|
28
|
+
|
|
29
|
+
def remove_step(self, step: ChainStep) -> None:
|
|
30
|
+
self.steps = [s for s in self._steps if s.key != step.key]
|
|
31
|
+
|
|
32
|
+
def execute(self, *args, **kwargs) -> Dict[str, Any]:
|
|
33
|
+
# Execute the chain and manage result storage based on return_key
|
|
34
|
+
for step in self.steps:
|
|
35
|
+
resolved_args = [self._resolve_placeholders(arg) for arg in step.args]
|
|
36
|
+
resolved_kwargs = {
|
|
37
|
+
k: self._resolve_placeholders(v)
|
|
38
|
+
for k, v in step.kwargs.items()
|
|
39
|
+
if k != "ref"
|
|
40
|
+
}
|
|
41
|
+
result = step.method(*resolved_args, **resolved_kwargs)
|
|
42
|
+
if step.ref: # step.ref is used here as the return_key analogy
|
|
43
|
+
resolved_ref = self._resolve_ref(step.ref)
|
|
44
|
+
self.context[resolved_ref] = result
|
|
45
|
+
self.update(
|
|
46
|
+
**{resolved_ref: result}
|
|
47
|
+
) # Update context with new state value
|
|
48
|
+
return self.context # or any specific result you intend to return
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from swarmauri.utils._lazy_import import _lazy_import
|
|
2
|
+
|
|
3
|
+
chains_files = [
|
|
4
|
+
("swarmauri.chains.concrete.CallableChain import", "CallableChain"),
|
|
5
|
+
("swarmauri.chains.concrete.ChainStep", "ChainStep"),
|
|
6
|
+
("swarmauri.chains.concrete.PromptContextChain", "PromptContextChain"),
|
|
7
|
+
("swarmauri.chains.concrete.ContextChain", "ContextChain"),
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
# Lazy loading of chain classes, storing them in variables
|
|
11
|
+
for module_name, class_name in chains_files:
|
|
12
|
+
globals()[class_name] = _lazy_import(module_name, class_name)
|
|
13
|
+
|
|
14
|
+
# Adding the lazy-loaded chain classes to __all__
|
|
15
|
+
__all__ = [class_name for _, class_name in chains_files]
|