Skip to content

Commit 3035f96

Browse files
committed
Updating tests to handle new params in logs for BYOK.
1 parent 2fd27c9 commit 3035f96

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

ols/utils/token_handler.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def truncate_rag_context(
121121
list of `RagChunk` objects, available tokens after context usage
122122
"""
123123
rag_chunks = []
124-
logger.info("Processing %d retrieved nodes for RAG context", len(retrieved_nodes))
124+
logger.info(
125+
"Processing %d retrieved nodes for RAG context", len(retrieved_nodes)
126+
)
125127

126128
for idx, node in enumerate(retrieved_nodes):
127129
score = float(node.get_score(raise_error=False))
@@ -190,7 +192,9 @@ def truncate_rag_context(
190192

191193
max_tokens -= available_tokens
192194

193-
logger.info("Final selection: %d documents chosen for RAG context", len(rag_chunks))
195+
logger.info(
196+
"Final selection: %d documents chosen for RAG context", len(rag_chunks)
197+
)
194198
return rag_chunks, max_tokens
195199

196200
def limit_conversation_history(

tests/unit/app/endpoints/test_ols.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,24 @@ def test_store_transcript(transcripts_location):
10471047
"query_is_valid": query_is_valid,
10481048
"llm_response": response,
10491049
"rag_chunks": [
1050-
{"text": "text1", "doc_url": "url1", "doc_title": "title1"},
1051-
{"text": "text2", "doc_url": "url2", "doc_title": "title2"},
1050+
{
1051+
"text": "text1",
1052+
"doc_url": "url1",
1053+
"doc_title": "title1",
1054+
"index_id": "",
1055+
"index_origin": "",
1056+
"similarity_score": 0.0,
1057+
"token_count": 0,
1058+
},
1059+
{
1060+
"text": "text2",
1061+
"doc_url": "url2",
1062+
"doc_title": "title2",
1063+
"index_id": "",
1064+
"index_origin": "",
1065+
"similarity_score": 0.0,
1066+
"token_count": 0,
1067+
},
10521068
],
10531069
"truncated": truncated,
10541070
"tool_calls": [

0 commit comments

Comments
 (0)