janus.converter.translate#

Attributes#

log

Classes#

Translator

A class that translates code from one programming language to another.

Module Contents#

janus.converter.translate.log#
class janus.converter.translate.Translator(target_language='python', target_version='3.10', **kwargs)#

Bases: janus.converter.converter.Converter

A class that translates code from one programming language to another.

Initialize a Translator instance.

Parameters:
  • model – The LLM to use for translation. If an OpenAI model, the OPENAI_API_KEY environment variable must be set.

  • model_arguments – Additional arguments to pass to the LLM constructor.

  • source_language – The source programming language.

  • target_language (str) – The target programming language.

  • target_version (str | None) – The target version of the target programming language.

  • max_prompts – The maximum number of prompts to try before giving up.

  • max_tokens – The maximum number of tokens the model will take in. If unspecificed, model’s default max will be used.

  • prompt_templates – name of prompt template directories (see janus/prompts/templates) or paths to directories.