mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
-Only for api_tool for now, if this solution works well then implementation for other tools is required - Need to check api keys creation with the current proxies - Show connection string example at creation - locale needs updates for other languages
18 lines
582 B
Python
18 lines
582 B
Python
from application.agents.classic_agent import ClassicAgent
|
|
|
|
|
|
class AgentCreator:
|
|
agents = {
|
|
"classic": ClassicAgent,
|
|
}
|
|
|
|
@classmethod
|
|
def create_agent(cls, type, *args, **kwargs):
|
|
agent_class = cls.agents.get(type.lower())
|
|
if not agent_class:
|
|
raise ValueError(f"No agent class found for type {type}")
|
|
config = kwargs.pop('config', None)
|
|
if isinstance(config, dict) and 'proxy_id' in config and 'proxy_id' not in kwargs:
|
|
kwargs['proxy_id'] = config['proxy_id']
|
|
return agent_class(*args, **kwargs)
|