MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / _format_and_add_data

Method _format_and_add_data

fastdeploy/engine/engine.py:650–672  ·  view source on GitHub ↗
(self, prompts: dict)

Source from the content-addressed store, hash-verified

648 return p
649
650 def _format_and_add_data(self, prompts: dict):
651
652 if "request_id" in prompts:
653 prompts["request_id"] = prompts["request_id"]
654
655 if "request_id" not in prompts:
656 request_id = str(uuid.uuid4())
657 prompts["request_id"] = request_id
658 query_list = []
659
660 if "context" in prompts:
661 for item in prompts["context"]:
662 if item["role"] == "system":
663 prompts["system"] = item["utterance"]
664 elif item["role"] in ["user", "assistant"]:
665 query_list.append(item["utterance"])
666 prompts["prompt"] = query_list
667
668 if "max_tokens" not in prompts:
669 prompts["max_tokens"] = self.cfg.model_config.max_model_len
670
671 self.add_requests(prompts)
672 return prompts["request_id"]
673
674 def generate(self, prompts, stream):
675 """

Callers 1

generateMethod · 0.95

Calls 1

add_requestsMethod · 0.95

Tested by

no test coverage detected