-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ygal Blum <[email protected]>
- Loading branch information
Showing
23 changed files
with
164 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
""" Hold application constants """ | ||
from pathlib import Path | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
""" Base class for history keepers """ | ||
from abc import ABC, abstractmethod | ||
from typing import List | ||
from typing import List, Dict, Any | ||
|
||
from langchain_core.messages import BaseMessage | ||
|
||
|
||
class HistoryBase(ABC): | ||
""" Base class for history keepers """ | ||
@abstractmethod | ||
def get_messages(self, session_id) -> List[BaseMessage]: | ||
pass | ||
def get_messages(self, session_id: str) -> List[BaseMessage]: | ||
""" Get all messages of the session """ | ||
|
||
@abstractmethod | ||
def add_to_history(self, session_id, answer): | ||
pass | ||
def add_to_history(self, session_id: str, answer: Dict[str, Any]): | ||
""" Add the answer to the session """ | ||
|
||
@abstractmethod | ||
def reset(self, session_id): | ||
pass | ||
def reset(self, session_id: str): | ||
""" Reset the session """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
""" Global injector for the application """ | ||
from injector import Injector | ||
|
||
from knowledge_base_gpt.libs.settings.settings import Settings, unsafe_typed_settings | ||
|
||
|
||
def create_application_injector() -> Injector: | ||
def _create_application_injector() -> Injector: | ||
_injector = Injector(auto_bind=True) | ||
_injector.binder.bind(Settings, to=unsafe_typed_settings) | ||
return _injector | ||
|
||
|
||
""" | ||
Global injector for the application. | ||
Avoid using this reference, it will make your code harder to test. | ||
Instead, use the `request.state.injector` reference, which is bound to every request | ||
""" | ||
global_injector: Injector = create_application_injector() | ||
# Global injector for the application. | ||
global_injector: Injector = _create_application_injector() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.