mirror of
https://gitee.com/agents-flex/agents-flex.git
synced 2024-11-30 02:47:46 +08:00
feat: add MapUtil.java
This commit is contained in:
parent
47c25e8bbf
commit
f7ab096796
@ -41,7 +41,6 @@ public class BaseLlmClientListener implements LlmClientListener {
|
||||
private final StringBuilder fullMessage = new StringBuilder();
|
||||
private AiMessage lastAiMessage;
|
||||
private boolean isFunctionCalling = false;
|
||||
|
||||
private final ChatContext context;
|
||||
|
||||
public BaseLlmClientListener(Llm llm, LlmClient client, MessageListener messageListener, Prompt prompt
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.agentsflex.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MapUtil {
|
||||
|
||||
public static Map<String, Object> ofSingleKey(String key, Object value) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(key, value);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static MapBuilder of() {
|
||||
return new MapBuilder();
|
||||
}
|
||||
|
||||
public static MapBuilder of(String key, Object value) {
|
||||
return new MapBuilder().put(key, value);
|
||||
}
|
||||
|
||||
public static class MapBuilder {
|
||||
private Map<String, Object> map = new HashMap<>();
|
||||
|
||||
public MapBuilder put(String key, Object value) {
|
||||
map.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, Object> build() {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user