Module aleph_ollama

aleph_ollama_translator: Translate source code files or strings to a target language using Ollama LLMs.

Description

aleph_ollama_translator: Translate source code files or strings to a target language using Ollama LLMs. This module provides a simple API to translate code from files or strings, leveraging the ollama_handler for prompt formatting and API calls. It handles environment configuration, prompt templates, and response parsing.

## Configuration - OLLAMA_MODEL: Model name (default: "qwen2.5-coder") - OLLAMA_URL: API endpoint (default: "http://localhost:11434/api/generate") - OLLAMA_PROMPT: Prompt template (optional) -------------------------------------------------------------------

Data Types

config()

config() = map()

file_path()

file_path() = string() | binary()

language()

language() = string() | binary()

translate_result()

translate_result() = {ok, binary()} | {error, term()}

Function Index

default_config/0
default_prompt_template/0
get_env_config/0
parse_response/1
translate_code/2
translate_code_from_string/2
translate_code_from_string_stream/2

Function Details

default_config/0

default_config() -> config()

default_prompt_template/0

default_prompt_template() -> string()

get_env_config/0

get_env_config() -> config()

parse_response/1

parse_response(Bin::binary()) -> {ok, binary()}

translate_code/2

translate_code(FilePath::file_path(), TargetLang::language()) -> translate_result()

translate_code_from_string/2

translate_code_from_string(Code::string(), TargetLang::language()) -> translate_result()

translate_code_from_string_stream/2

translate_code_from_string_stream(Code::string(), TargetLang::language()) -> translate_result()


Generated by EDoc