generation
RAG Generation package.
Modules:
-
base
–Base classes for generation.
-
cohere
–CohereGen class for text generation using Cohere's API.
-
deepseek
–DeepSeek generation module.
-
fireworks
–FireworksGen class for text generation using Fireworks API.
-
gemini
–GeminiGen class for text generation using Google's Gemini model.
-
groq
–Groq class for text generation.
-
hugging_face
–Hugging Face classes for text generation.
-
hugging_face_inf
–Hugging Face inferencing classes for text generation.
-
llama
–Llama generation module.
-
openai
–OpenAI Generation Model class for flexible GPT-based text generation.
-
phi
–Phi generation module.
-
together
–TogetherGen class for text generation using Together AI's API.
Classes:
-
CohereGen
–Cohere generation model for text generation.
-
DeepSeekGen
–DeepSeek Generation class.
-
FireworksGen
–Fireworks AI generation model for text generation.
-
GeminiGen
–Gemini generation model for text generation.
-
GenerationBase
–Generic Generation class.
-
GroqGen
–Groq generation model for text generation.
-
HuggingFaceGen
–HuggingFaceGen.
-
HuggingFaceInfGen
–HuggingFaceGen with InferenceClient.
-
LlamaGen
–Llama Generation class.
-
OllamaGen
–Ollama Generation class for local inference via ollama-python.
-
OllamaOpenAIGen
–OllamaGen via the Ollama Python client.
-
OpenAIGen
–OpenAI generation model for text generation.
-
PhiGen
–Phi Generation class.
-
TogetherGen
–Together AI generation model for text generation.
CohereGen
CohereGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Cohere generation model for text generation.
Methods:
-
generate
–Generate text using Cohere's API.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Cohere's API.
Source code in src/rago/generation/cohere.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
DeepSeekGen
DeepSeekGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
DeepSeek Generation class.
Methods:
-
generate
–Generate text using DeepSeek model with chat template.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using DeepSeek model with chat template.
Source code in src/rago/generation/deepseek.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
FireworksGen
FireworksGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Fireworks AI generation model for text generation.
Methods:
-
generate
–Generate text using Fireworks AI's API.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Fireworks AI's API.
Source code in src/rago/generation/fireworks.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
GeminiGen
GeminiGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Gemini generation model for text generation.
Methods:
-
generate
–Generate text using Gemini model support.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Gemini model support.
Source code in src/rago/generation/gemini.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
GenerationBase
GenerationBase(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: RagoBase
Generic Generation class.
Methods:
-
generate
–Generate text with optional language parameter.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
abstractmethod
Generate text with optional language parameter.
Parameters:
-
query
(str
) –The input query or prompt.
-
context
(list[str]
) –Additional context information for the generation.
Returns:
-
str
–Generated text based on query and context.
Source code in src/rago/generation/base.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
GroqGen
GroqGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Groq generation model for text generation.
Methods:
-
generate
–Generate text using the Groq AP.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using the Groq AP.
Source code in src/rago/generation/groq.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
HuggingFaceGen
HuggingFaceGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
HuggingFaceGen.
Methods:
-
generate
–Generate the text from the query and augmented context.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate the text from the query and augmented context.
Source code in src/rago/generation/hugging_face.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
HuggingFaceInfGen
HuggingFaceInfGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
HuggingFaceGen with InferenceClient.
Methods:
-
generate
–Generate the text from the query and augmented context.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate the text from the query and augmented context.
Source code in src/rago/generation/hugging_face_inf.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
LlamaGen
LlamaGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Llama Generation class.
Methods:
-
generate
–Generate text using Llama model with language support.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Llama model with language support.
Source code in src/rago/generation/llama.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
OllamaGen
OllamaGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Ollama Generation class for local inference via ollama-python.
Methods:
-
generate
–Generate text by sending a prompt to the local Ollama model.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text by sending a prompt to the local Ollama model.
Parameters:
Returns:
-
str
–The generated response text.
Source code in src/rago/generation/llama.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
OllamaOpenAIGen
OllamaOpenAIGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: OpenAIGen
OllamaGen via the Ollama Python client.
Methods:
-
generate
–Generate text using OpenAI's API with dynamic model support.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using OpenAI's API with dynamic model support.
Source code in src/rago/generation/openai.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
OpenAIGen
OpenAIGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
OpenAI generation model for text generation.
Methods:
-
generate
–Generate text using OpenAI's API with dynamic model support.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using OpenAI's API with dynamic model support.
Source code in src/rago/generation/openai.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
PhiGen
PhiGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Phi Generation class.
Methods:
-
generate
–Generate text using Phi model with context.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Phi model with context.
Source code in src/rago/generation/phi.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
TogetherGen
TogetherGen(
model_name: Optional[str] = None,
temperature: Optional[float] = None,
prompt_template: str = '',
output_max_length: int = 500,
device: str = 'auto',
structured_output: Optional[Type[BaseModel]] = None,
system_message: str = '',
api_params: dict[str, Any] = DEFAULT_API_PARAMS,
api_key: str = '',
cache: Optional[Cache] = None,
logs: dict[str, Any] = DEFAULT_LOGS,
)
Bases: GenerationBase
Together AI generation model for text generation.
Methods:
-
generate
–Generate text using Together AI's API.
Source code in src/rago/generation/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
generate
Generate text using Together AI's API.
Source code in src/rago/generation/together.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|