Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove experimental augmenteds #21

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/rago/augmented/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,24 @@ class AugmentedBase:
model_name: str = ''
db: Any
top_k: int = 0
temperature: float = 0.5
prompt_template: str = ''
result_separator = '\n'
output_max_length: int = 500

# default values to be overwritten by the derived classes
default_model_name: str = ''
default_top_k: int = 0
default_temperature: float = 0.5
default_prompt_template: str = (
'Retrieve {top_k} entries from the context that better answer the '
'following query:\n```\n{query}\n```\n\ncontext:\n```\n{context}\n```'
)
default_result_separator = '\n'
default_output_max_length: int = 500

def __init__(
self,
model_name: str = '',
api_key: str = '',
db: DBBase = FaissDB(),
top_k: int = 0,
temperature: float = 0.5,
prompt_template: str = '',
result_separator: str = '\n',
output_max_length: int = 500,
) -> None:
"""Initialize AugmentedBase."""
self.db = db
self.api_key = api_key

self.top_k = top_k or self.default_top_k
self.model_name = model_name or self.default_model_name
self.temperature = temperature or self.default_temperature
self.result_separator = (
result_separator or self.default_result_separator
)
self.prompt_template = prompt_template or self.default_prompt_template
self.output_max_length = (
output_max_length or self.default_output_max_length
)

self.model = None

self._validate()
Expand Down
1 change: 0 additions & 1 deletion src/rago/augmented/experimental/__init__.py

This file was deleted.

41 changes: 0 additions & 41 deletions src/rago/augmented/experimental/gemini.py

This file was deleted.

6 changes: 2 additions & 4 deletions tests/test_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from rago import Rago
from rago.augmented.experimental.gemini import GeminiAug
from rago.augmented import SentenceTransformerAug
from rago.generation import GeminiGen
from rago.retrieval import StringRet

Expand All @@ -27,9 +27,7 @@ def test_gemini_generation(animals_data: list[str], api_key: str) -> None:
# Instantiate Rago with the Gemini model
rag = Rago(
retrieval=StringRet(animals_data),
augmented=GeminiAug(
top_k=3
), # Update if using a specific augmentation class for Gemini
augmented=SentenceTransformerAug(top_k=3),
generation=GeminiGen(api_key=api_key, model_name='gemini-1.5-flash'),
)

Expand Down
Loading