MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / do_translate

Method do_translate

pdf2zh/translator.py:445–456  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

443 ),
444 )
445 def do_translate(self, text) -> str:
446 response = self.client.chat.completions.create(
447 model=self.model,
448 **self.options,
449 messages=self.prompt(text, self.prompttext),
450 )
451 if not response.choices:
452 if hasattr(response, "error"):
453 raise ValueError("Error response from Service", response.error)
454 content = response.choices[0].message.content.strip()
455 content = self.think_filter_regex.sub("", content).strip()
456 return content
457
458 def get_formular_placeholder(self, id: int):
459 return "{{v" + str(id) + "}}"

Callers

nothing calls this directly

Calls 1

promptMethod · 0.80

Tested by

no test coverage detected