001/**
002 * Copyright (c) 2025-2026, Michael Yang 杨福海 (fuhai999@gmail.com).
003 * <p>
004 * Licensed under the GNU Lesser General Public License (LGPL) ,Version 3.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * http://www.gnu.org/licenses/lgpl-3.0.txt
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package dev.tinyflow.core;
017
018import com.agentsflex.core.chain.Chain;
019import dev.tinyflow.core.parser.ChainParser;
020import dev.tinyflow.core.provder.LlmProvider;
021
022import java.util.Map;
023
024public class Tinyflow {
025
026    private String data;
027    private Chain chain;
028    private LlmProvider llmProvider;
029
030
031    public Tinyflow(String flowData) {
032        this.data = flowData;
033        this.chain = ChainParser.parse(this);
034    }
035
036    public Chain getChain() {
037        return chain;
038    }
039
040    public void setChain(Chain chain) {
041        this.chain = chain;
042    }
043
044    public String getData() {
045        return data;
046    }
047
048    public void setData(String data) {
049        this.data = data;
050    }
051
052    public LlmProvider getLlmProvider() {
053        return llmProvider;
054    }
055
056    public void setLlmProvider(LlmProvider llmProvider) {
057        this.llmProvider = llmProvider;
058    }
059
060    public void execute(Map<String, Object> variables) {
061        chain.execute(variables);
062    }
063
064    public Map<String, Object> executeForResult(Map<String, Object> variables) {
065        return chain.executeForResult(variables);
066    }
067}