Commit e0ccd3d 1 parent d0adb81 commit e0ccd3d Copy full SHA for e0ccd3d
File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,14 @@ def __init__(
116
116
vector_db : VectorStore | None = None ,
117
117
embedder : Embeddings | None = None ,
118
118
storage : StorageBase | None = None ,
119
+ user_id : UUID | None = None ,
120
+ chat_id : UUID | None = None ,
119
121
):
120
122
self .id = id
121
123
self .name = name
122
124
self .storage = storage
123
-
125
+ self .user_id = user_id
126
+ self .chat_id = chat_id
124
127
# Chat history
125
128
self ._chats = self ._init_chats ()
126
129
self .default_chat = list (self ._chats .values ())[0 ]
@@ -535,8 +538,15 @@ async def ask_streaming(
535
538
list_files = [] if list_files is None else list_files
536
539
537
540
full_answer = ""
541
+ metadata = {
542
+ "langfuse_user_id" : str (self .user_id ),
543
+ "langfuse_session_id" : str (self .chat_id ),
544
+ }
538
545
async for response in rag_instance .answer_astream (
539
- question = question , history = chat_history , list_files = list_files
546
+ question = question ,
547
+ history = chat_history ,
548
+ list_files = list_files ,
549
+ metadata = metadata ,
540
550
):
541
551
# Format output to be correct servicedf;j
542
552
if not response .last_chunk :
You can’t perform that action at this time.
0 commit comments