database chat external user's api
Browse files- controller.py +2 -3
controller.py
CHANGED
|
@@ -7,14 +7,14 @@ import threading
|
|
| 7 |
import uuid
|
| 8 |
from fastapi import FastAPI, HTTPException, Header
|
| 9 |
from fastapi.encoders import jsonable_encoder
|
| 10 |
-
from typing import Dict, List,
|
| 11 |
from fastapi.responses import FileResponse
|
| 12 |
import numpy as np
|
| 13 |
import pandas as pd
|
| 14 |
from pandasai import SmartDataframe
|
| 15 |
from langchain_groq.chat_models import ChatGroq
|
| 16 |
from dotenv import load_dotenv
|
| 17 |
-
from pydantic import BaseModel, Field
|
| 18 |
from csv_service import clean_data, extract_chart_filenames, generate_csv_data, get_csv_basic_info
|
| 19 |
from urllib.parse import unquote
|
| 20 |
from langchain_groq import ChatGroq
|
|
@@ -311,7 +311,6 @@ def langchain_csv_chat(csv_url: str, question: str, chart_required: bool):
|
|
| 311 |
if current_langchain_key_index >= len(groq_api_keys):
|
| 312 |
current_langchain_key_index = 0
|
| 313 |
api_key = groq_api_keys[current_langchain_key_index]
|
| 314 |
-
current_key = current_langchain_key_index
|
| 315 |
current_langchain_key_index += 1
|
| 316 |
attempts += 1
|
| 317 |
|
|
|
|
| 7 |
import uuid
|
| 8 |
from fastapi import FastAPI, HTTPException, Header
|
| 9 |
from fastapi.encoders import jsonable_encoder
|
| 10 |
+
from typing import Dict, List, Optional
|
| 11 |
from fastapi.responses import FileResponse
|
| 12 |
import numpy as np
|
| 13 |
import pandas as pd
|
| 14 |
from pandasai import SmartDataframe
|
| 15 |
from langchain_groq.chat_models import ChatGroq
|
| 16 |
from dotenv import load_dotenv
|
| 17 |
+
from pydantic import BaseModel, Field
|
| 18 |
from csv_service import clean_data, extract_chart_filenames, generate_csv_data, get_csv_basic_info
|
| 19 |
from urllib.parse import unquote
|
| 20 |
from langchain_groq import ChatGroq
|
|
|
|
| 311 |
if current_langchain_key_index >= len(groq_api_keys):
|
| 312 |
current_langchain_key_index = 0
|
| 313 |
api_key = groq_api_keys[current_langchain_key_index]
|
|
|
|
| 314 |
current_langchain_key_index += 1
|
| 315 |
attempts += 1
|
| 316 |
|