Format Python code with psf/black push

github-actions 2 years ago
parent 1a63fb84c0
commit 7ba0254e87

@ -76,7 +76,7 @@ async def get_and_query(
llm_predictor=llm_predictor,
refine_template=CHAT_REFINE_PROMPT,
embed_model=embed_model,
#optimizer=SentenceEmbeddingOptimizer(threshold_cutoff=0.7)
# optimizer=SentenceEmbeddingOptimizer(threshold_cutoff=0.7)
)
else:
response = await index.aquery(
@ -86,7 +86,7 @@ async def get_and_query(
embed_model=embed_model,
similarity_top_k=nodes,
refine_template=CHAT_REFINE_PROMPT,
#optimizer=SentenceEmbeddingOptimizer(threshold_cutoff=0.7)
# optimizer=SentenceEmbeddingOptimizer(threshold_cutoff=0.7)
)
return response
@ -922,7 +922,16 @@ class Index_handler:
try:
embedding_model = OpenAIEmbedding()
embedding_model.last_token_usage = 0
response = await get_and_query(ctx.user.id, self.index_storage, query, response_mode, nodes, self.llm_predictor, embedding_model, child_branch_factor)
response = await get_and_query(
ctx.user.id,
self.index_storage,
query,
response_mode,
nodes,
self.llm_predictor,
embedding_model,
child_branch_factor,
)
print("The last token usage was ", self.llm_predictor.last_token_usage)
await self.usage_service.update_usage(
self.llm_predictor.last_token_usage, chatgpt=True

@ -455,9 +455,25 @@ class Search:
embedding_model.last_token_usage = 0
if not deep:
response = await index.aquery(query, embed_model=embedding_model, llm_predictor=llm_predictor, refine_template=CHAT_REFINE_PROMPT, similarity_top_k=nodes or DEFAULT_SEARCH_NODES, text_qa_template=self.qaprompt, response_mode=response_mode)
response = await index.aquery(
query,
embed_model=embedding_model,
llm_predictor=llm_predictor,
refine_template=CHAT_REFINE_PROMPT,
similarity_top_k=nodes or DEFAULT_SEARCH_NODES,
text_qa_template=self.qaprompt,
response_mode=response_mode,
)
else:
response = await index.aquery(query, embed_model=embedding_model, llm_predictor=llm_predictor, refine_template=CHAT_REFINE_PROMPT, similarity_top_k=nodes or DEFAULT_SEARCH_NODES, text_qa_template=self.qaprompt, response_mode=response_mode)
response = await index.aquery(
query,
embed_model=embedding_model,
llm_predictor=llm_predictor,
refine_template=CHAT_REFINE_PROMPT,
similarity_top_k=nodes or DEFAULT_SEARCH_NODES,
text_qa_template=self.qaprompt,
response_mode=response_mode,
)
await self.usage_service.update_usage(
llm_predictor.last_token_usage, chatgpt=True

Loading…
Cancel
Save