MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / get_available_instance

Method get_available_instance

CommonKG/llm_infer.py:37–42  ·  view source on GitHub ↗

使用轮询策略获取一个可用的实例

(self)

Source from the content-addressed store, hash-verified

35 # subprocess.Popen(cmd, shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
36
37 def get_available_instance(self):
38 """使用轮询策略获取一个可用的实例"""
39 with self.lock:
40 instance = self.instances[self.current_instance]
41 self.current_instance = (self.current_instance + 1) % len(self.instances)
42 return instance["port"] # 返回端口
43
44 def generate_text(self, prompt, model="qwen:72b", temperature=0):
45 """发送请求到选择的实例"""

Callers 2

generate_textMethod · 0.95
vllm_generate_textMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected