Skip to content

Commit a1444c2

Browse files
committed
Bring back embedding logs, at DEBUG level
1 parent ad31bb0 commit a1444c2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/backend/prepdocs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async def main(strategy: Strategy, setup_index: bool = True):
325325
logging.basicConfig(format="%(message)s", datefmt="[%X]", handlers=[RichHandler(rich_tracebacks=True)])
326326
# We only set the level to INFO for our logger,
327327
# to avoid seeing the noisy INFO level logs from the Azure SDKs
328-
logger.setLevel(logging.DEBUG)
328+
logger.setLevel(logging.INFO)
329329

330330
load_azd_env()
331331

app/backend/prepdocslib/embeddings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ async def create_embedding_batch(self, texts: list[str], dimensions_args: ExtraA
114114
model=self.open_ai_model_name, input=batch.texts, **dimensions_args
115115
)
116116
embeddings.extend([data.embedding for data in emb_response.data])
117-
117+
logger.debug(
118+
"Computed embeddings in batch. Batch size: %d, Token count: %d",
119+
len(batch.texts),
120+
batch.token_length,
121+
)
118122
return embeddings
119123

120124
async def create_embedding_single(self, text: str, dimensions_args: ExtraArgs) -> list[float]:
@@ -129,7 +133,7 @@ async def create_embedding_single(self, text: str, dimensions_args: ExtraArgs) -
129133
emb_response = await client.embeddings.create(
130134
model=self.open_ai_model_name, input=text, **dimensions_args
131135
)
132-
136+
logger.debug("Computed embedding for text section. Character count: %d", len(text))
133137
return emb_response.data[0].embedding
134138

135139
async def create_embeddings(self, texts: list[str]) -> list[list[float]]:

0 commit comments

Comments
 (0)