@classmethod
def from_config(cls, config):
    agent_name = config['agent_name']
    es_config = config['es_index']
    es_index = ESIndex.from_config(es_config)
    vector_index_config = config['vector_index']
    vector_index = VectorIndex.from_config(vector_index_config)
    if config['build_index_at_start']:
        es_index.build_index_from_file(config['document_file'])
        time.sleep(5)
        vector_index.build_index(es_index)
    vector_index.load_index()
    threshold = config['threshold']
    topk = config['topk']
    prompt_threshold = config['prompt_threshold']
    template = Template(filename=config['template'])
    prompt_template = Template(filename=config['prompt_template'])
    return cls(agent_name, es_index, vector_index, threshold, topk, prompt_threshold, template, prompt_template)
@classmethod
def from_config(cls, config):
    agent_name = config['agent_name']
    es_config = config['es_index']
    es_index = ESIndex.from_config(es_config)
    vector_index_config = config['vector_index']
    vector_index = VectorIndex.from_config(vector_index_config)
    if config['build_index_at_start']:
        es_index.build_index_from_file(config['document_file'])
        time.sleep(5)
        vector_index.build_index(es_index)
    vector_index.load_index()
    threshold = config['threshold']
    topk = config['topk']
    prompt_threshold = config['prompt_threshold']
    template = Template(filename=config['template'])
    prompt_template = Template(filename=config['prompt_template'])
    return cls(agent_name, es_index, vector_index, threshold, topk, prompt_threshold, template, prompt_template)