MCPcopy Create free account
hub / github.com/CL-lau/SQL-GPT / get_response

Function get_response

components/response_handler.py:5–32  ·  view source on GitHub ↗
(query: str, model)

Source from the content-addressed store, hash-verified

3app_logger = logger.get_logger(__name__)
4
5def get_response(query: str, model) -> str:
6 app_logger.info(f'\033[36mUser Query: {query}\033[0m')
7 try:
8 if model is not None and query:
9 response = model.run(query)
10 app_logger.info(f'\033[36mLLM Response: {response}\033[0m')
11 return response
12 return (
13 'Your model still not created.\n'
14 '1. If you are using gpt4free model, '
15 'try to re-select a provider. '
16 '(Click the "Show Available Providers" button in sidebar)\n'
17 '2. If you are using openai model, '
18 'try to re-pass openai api key.\n'
19 '3. Or you did not pass the file successfully.\n'
20 '4. Try to Refresh the page (F5).'
21 )
22 except Exception as e:
23 app_logger.info(f'{__file__}: {e}')
24 return (
25 'Something wrong in docGPT...\n'
26 '1. If you are using gpt4free model, '
27 'try to select the different provider. '
28 '(Click the "Show Available Providers" button in sidebar)\n'
29 '2. If you are using openai model, '
30 'check your usage for openai api key.\n'
31 '3. Try to Refresh the page (F5).'
32 )

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected