Skip to content

Mvr/#14/ids managment#19

Open
MatthiasvonRakowski wants to merge 5 commits into
devfrom
mvr/#14/ids_managment
Open

Mvr/#14/ids managment#19
MatthiasvonRakowski wants to merge 5 commits into
devfrom
mvr/#14/ids_managment

Conversation

@MatthiasvonRakowski
Copy link
Copy Markdown
Contributor

add of a simple rag system and a simple id management

Copy link
Copy Markdown
Contributor

@Popochounet Popochounet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faut que tu m'explique le rag ce sera plus simple

Comment thread src/core/huri.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense qu'il faut initialiser la Session avec le user_id pour eviter le if "rag"
Quitte a ajouter un ModuleWithId qui s'initialise avec un user id, dans le module Factory

Comment thread src/modules/rag/rag.py
)


class RAG(ModuleWithHandle):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

///
dans core/module.py
class ModuleWithHandle:
def init(self, _handle=None, **kwargs):
super().init(**kwargs)
self._handle = _handle
...

class ModuleWithId:
def init(self, _user_id, **kwargs):
super().init(**kwargs)
self._user_id = _user_id

/////
dans rag.py:
class RAG(ModuleWithHandle, ModuleWithId):
def init(self, kwargs):
super().init(**kwargs)
...

//////////////
Et dans factory.py:

def create(
self,
user_id: str,
name: str,
args: Mapping[str, Any] | None = None
) -> Module:

if name not in self._registry:
    raise ValueError(f"Unknown module '{name}'")

module_cls = self._registry[name]

kwargs = dict(args or {})

if issubclass(module_cls, ModuleWithHandle):
    if name not in self._handles:
        raise RuntimeError(
            f"Handles not bound for '{name}'. Check your config first."
        )

    kwargs["_handle"] = self._handles[name]

if issubclass(module_cls, ModuleWithId):
    kwargs["_user_id"] = user_id

return module_cls(**kwargs)

def create_from_config(
self, user_id: str, module_configs: Dict[str, ModuleConfig]
) -> List[Module]:
modules: List[Module] = []
for _, module_config in module_configs.items():
modules.append(self.create(user_id, module_config.name, module_config.args))

    if modules == []:
        raise Exception

    return modules

///////
J'ai remplacé handle par _handle c'est plus propre
Qu'en penses tu globalement, pour user id ??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la preview de mon message est degueulasse

Comment thread src/client.py
from src.core.dataclasses.config import ClientConfig


USER_ID_FILE = os.path.expanduser("~/.huri_user_id")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre dans un .env peut etre ? ou pas en vrai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants