MCPcopy Create free account

hub / github.com/andrewyng/translation-agent / functions

Functions41 in github.com/andrewyng/translation-agent

↓ 9 callersFunctionnum_tokens_in_string
Calculate the number of tokens in a given string using a specified encoding. Args: str (str): The input string to be tokenized.
src/translation_agent/utils.py:263
↓ 8 callersFunctionget_completion
Generate a completion using the OpenAI API. Args: prompt (str): The user's prompt or query. system_message (str, optiona
src/translation_agent/utils.py:20
↓ 4 callersFunctionone_chunk_improve_translation
Use the reflection to improve the translation, treating the entire text as one chunk. Args: source_lang (str): The source language o
src/translation_agent/utils.py:175
↓ 4 callersFunctionone_chunk_initial_translation
Translate the entire text as one chunk using an LLM. Args: source_lang (str): The source language of the text. target_lang (
src/translation_agent/utils.py:72
↓ 4 callersFunctionone_chunk_reflect_on_translation
Use an LLM to reflect on the translation, treating the entire text as one chunk. Args: source_lang (str): The source language of the
src/translation_agent/utils.py:100
↓ 3 callersFunctioncalculate_chunk_size
Calculate the chunk size based on the token count and token limit. Args: token_count (int): The total number of tokens. toke
src/translation_agent/utils.py:594
↓ 3 callersFunctionmodel_load
( endpoint: str, base_url: str, model: str, api_key: Optional[str] = None, temperatur
app/patch.py:21
↓ 3 callersFunctionmultichunk_improve_translation
Improves the translation of a text from source language to target language by considering expert suggestions. Args: source_lang (str
src/translation_agent/utils.py:468
↓ 3 callersFunctionmultichunk_initial_translation
Translate a text in multiple chunks from the source language to the target language. Args: source_lang (str): The source language of
src/translation_agent/utils.py:288
↓ 3 callersFunctionmultichunk_reflect_on_translation
Provides constructive criticism and suggestions for improving a partial translation. Args: source_lang (str): The source language of
src/translation_agent/utils.py:347
↓ 2 callersFunctionone_chunk_translate_text
Translate a single chunk of text from the source language to the target language. This function performs a two-step translation process:
src/translation_agent/utils.py:231
↓ 2 callersFunctiontokenize
(text)
app/process.py:48
↓ 1 callersFunctiondiff_texts
(text1, text2)
app/process.py:66
↓ 1 callersFunctionextract_docx
(path)
app/process.py:39
↓ 1 callersFunctionextract_pdf
(path)
app/process.py:31
↓ 1 callersFunctionextract_text
(path)
app/process.py:25
↓ 1 callersFunctionmultichunk_translation
Improves the translation of multiple text chunks based on the initial translation and reflection. Args: source_lang (str): The sourc
src/translation_agent/utils.py:554
↓ 1 callersFunctiontranslator
Translate the source_text from source_lang to target_lang.
app/process.py:90
↓ 1 callersFunctiontranslator_sec
Translate the source_text from source_lang to target_lang.
app/process.py:171
Functionclose_btn_hide
(output_diff)
app/app.py:157
Functionclose_btn_show
()
app/app.py:153
Functiondecorator
(func)
app/patch.py:63
Functionenable_sec
(choice)
app/app.py:113
Functionexample_data
()
tests/test_agent.py:153
Functionexport_txt
(strings)
app/app.py:124
Functionget_completion
Generate a completion using the OpenAI API. Args: prompt (str): The user's prompt or query. system_message (str, op
app/patch.py:88
Functionhuanik
( endpoint: str, base: str, model: str, api_key: str, choice: str, endpoint2: st
app/app.py:17
Functionrate_limit
(get_max_per_minute)
app/patch.py:62
Functionread_doc
(path)
app/app.py:98
Functionswitch
(source_lang, source_text, target_lang, output_final)
app/app.py:136
Functiontest_get_completion_json_mode_api_call
()
tests/test_agent.py:23
Functiontest_get_completion_non_json_mode_api_call
()
tests/test_agent.py:43
Functiontest_num_tokens_in_string
()
tests/test_agent.py:262
Functiontest_one_chunk_improve_translation
(mock_get_completion, example_data)
tests/test_agent.py:164
Functiontest_one_chunk_initial_translation
()
tests/test_agent.py:63
Functiontest_one_chunk_reflect_on_translation
()
tests/test_agent.py:97
Functiontest_one_chunk_translate_text
(mocker)
tests/test_agent.py:218
Functiontranslate
Translate the source_text from source_lang to target_lang.
src/translation_agent/utils.py:635
Functionupdate_menu
(visible)
app/app.py:120
Functionupdate_model
(endpoint)
app/app.py:83
Functionwrapper
(*args, **kwargs)
app/patch.py:68