Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanKishore committed Oct 23, 2023
1 parent 1db0653 commit c721fbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
14 changes: 7 additions & 7 deletions mirageml/commands/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .config import load_config
from .utils.brain import llm_call
from .utils.codeblocks import add_indices_to_code_blocks
from .utils.custom_inputs import multiline_input
from .utils.prompt_templates import RAG_TEMPLATE
from .utils.vectordb import (
Expand All @@ -15,7 +16,6 @@
qdrant_search,
remote_qdrant_search,
)
from .utils.codeblocks import add_indices_to_code_blocks

console = Console()
config = load_config()
Expand Down Expand Up @@ -164,11 +164,11 @@ def rag_chat(sources):
chat_history.append({"role": "assistant", "content": ai_response})
indexed_ai_response = add_indices_to_code_blocks(ai_response)
console.print(
Panel(
Markdown(indexed_ai_response),
title="[bold blue]Assistant[/bold blue]",
box=HORIZONTALS,
border_style="blue",
)
Panel(
Markdown(indexed_ai_response),
title="[bold blue]Assistant[/bold blue]",
box=HORIZONTALS,
border_style="blue",
)
)
return chat_history, ai_response
11 changes: 3 additions & 8 deletions mirageml/commands/utils/vectordb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import os
import re
import uuid
from concurrent.futures import ThreadPoolExecutor

import keyring
import requests
import tiktoken
import typer
from concurrent.futures import ThreadPoolExecutor

from qdrant_client import QdrantClient
from qdrant_client.http.models import Distance, PointStruct, VectorParams
from rich.console import Console
Expand Down Expand Up @@ -65,13 +64,9 @@ def make_request(args):
"metadata": [metadata_value],
}
if i == 0:
response = requests.post(
VECTORDB_CREATE_ENDPOINT, json=json_data, headers=get_headers(), stream=True
)
response = requests.post(VECTORDB_CREATE_ENDPOINT, json=json_data, headers=get_headers(), stream=True)
else:
response = requests.post(
VECTORDB_UPSERT_ENDPOINT, json=json_data, headers=get_headers(), stream=True
)
response = requests.post(VECTORDB_UPSERT_ENDPOINT, json=json_data, headers=get_headers(), stream=True)

if response.status_code == 200:
for chunk in response.iter_lines():
Expand Down

0 comments on commit c721fbc

Please sign in to comment.