Spaces:
Sleeping
Sleeping
Asaad Almutareb commited on
Commit ·
aae1d57
1
Parent(s): 5bf49b7
changed the memory key "query" to "human_message" as it could confuse the agent
Browse filesupdated the sources output to indicate when knowledge comes from the kb
moved the sources cache location to config.ini
app.py
CHANGED
|
@@ -56,12 +56,15 @@ if __name__ == "__main__":
|
|
| 56 |
documents=[response['output']],
|
| 57 |
metadatas=[
|
| 58 |
{
|
| 59 |
-
"
|
| 60 |
-
"sources":src_list
|
| 61 |
}
|
| 62 |
]
|
| 63 |
)
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
history[-1][1] = response_w_sources
|
| 66 |
return history
|
| 67 |
|
|
|
|
| 56 |
documents=[response['output']],
|
| 57 |
metadatas=[
|
| 58 |
{
|
| 59 |
+
"human_message":history[-1][0],
|
| 60 |
+
"sources": src_list
|
| 61 |
}
|
| 62 |
]
|
| 63 |
)
|
| 64 |
+
if not sources:
|
| 65 |
+
response_w_sources = response['output']+"\n\n\n Sources: \n\n\n Internal knowledge base"
|
| 66 |
+
else:
|
| 67 |
+
response_w_sources = response['output']+"\n\n\n Sources: \n\n\n"+src_list
|
| 68 |
history[-1][1] = response_w_sources
|
| 69 |
return history
|
| 70 |
|
innovation_pathfinder_ai/config.ini
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
[main]
|
| 2 |
-
VECTOR_DATABASE_LOCATION = innovation_pathfinder_ai/
|
| 3 |
-
CONVERSATION_COLLECTION_NAME = ConversationMemory
|
|
|
|
|
|
| 1 |
[main]
|
| 2 |
+
VECTOR_DATABASE_LOCATION = innovation_pathfinder_ai/knowledge_base/
|
| 3 |
+
CONVERSATION_COLLECTION_NAME = ConversationMemory
|
| 4 |
+
SOURCES_CACHE = innovation_pathfinder_ai/database/sources_cache.sqlite3
|
innovation_pathfinder_ai/database/db_handler.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
from sqlmodel import SQLModel, create_engine, Session, select
|
| 2 |
from innovation_pathfinder_ai.database.schema import Sources
|
| 3 |
from innovation_pathfinder_ai.utils.logger import get_console_logger
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
sqlite_url = f"sqlite:///{sqlite_file_name}"
|
| 7 |
engine = create_engine(sqlite_url, echo=False)
|
| 8 |
|
|
|
|
| 1 |
from sqlmodel import SQLModel, create_engine, Session, select
|
| 2 |
from innovation_pathfinder_ai.database.schema import Sources
|
| 3 |
from innovation_pathfinder_ai.utils.logger import get_console_logger
|
| 4 |
+
from configparser import ConfigParser
|
| 5 |
+
# from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
|
| 6 |
|
| 7 |
+
config = ConfigParser()
|
| 8 |
+
config.read('innovation_pathfinder_ai/config.ini')
|
| 9 |
+
|
| 10 |
+
sqlite_file_name = config.get('main', 'SOURCES_CACHE')
|
| 11 |
sqlite_url = f"sqlite:///{sqlite_file_name}"
|
| 12 |
engine = create_engine(sqlite_url, echo=False)
|
| 13 |
|