Skip to content

Mvr/#14/ids managment#19

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

Mvr/#14/ids managment#19
MatthiasvonRakowski wants to merge 6 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

Copy link
Copy Markdown
Contributor Author

@MatthiasvonRakowski MatthiasvonRakowski May 15, 2026

Choose a reason for hiding this comment

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

On doit laisser la création du User ID dans huri.py car si on a plusieurs ModuleWithHandleAndID on peut se trouver avec plusieurs ID différent. Par contre je suis d'accord pour le "rag" Et je change ça

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


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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

t'entends quoi par user id? je le met en mode _user_id ? Sinon oui tout me va

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Je ne sais pas comment c'est fait dans l'industrie, faut se renseigner

…ith id and module with handle. Make some refacto : user_id -> _user_id and handle -> _handle
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.

lgtm
Juste pour le _handle et _user_id, je pense c'est plus logiqe de les ecrire handle et user_id avant qu'ils soient dans la factory
dans la config "user_id", et dans Factory.create: kwargs["_user_id"] = user_id, kwargs["_handle"] = ...

Jsp perso c'est plus logique comme ca mais apres c'est vraiment pas hyper important

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