quivr/backend/llm/utils/get_prompt_to_use_id.py
Zineb El Bachiri f48dab4a7d
refactor: to modules (#1754)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2023-11-30 22:29:28 +01:00

22 lines
470 B
Python

from typing import Optional
from uuid import UUID
from modules.brain.service.brain_service import BrainService
brain_service = BrainService()
def get_prompt_to_use_id(
brain_id: Optional[UUID], prompt_id: Optional[UUID]
) -> Optional[UUID]:
if brain_id is None and prompt_id is None:
return None
return (
prompt_id
if prompt_id
else brain_service.get_brain_prompt_id(brain_id)
if brain_id
else None
)