mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-21 02:23:31 +02:00
Break the Danswer LLM logging from LiteLLM Verbose (#1795)
This commit is contained in:
2
.vscode/env_template.txt
vendored
2
.vscode/env_template.txt
vendored
@ -8,7 +8,7 @@ AUTH_TYPE=disabled
|
|||||||
|
|
||||||
# Always keep these on for Dev
|
# Always keep these on for Dev
|
||||||
# Logs all model prompts to stdout
|
# Logs all model prompts to stdout
|
||||||
LOG_ALL_MODEL_INTERACTIONS=True
|
LOG_DANSWER_MODEL_INTERACTIONS=True
|
||||||
# More verbose logging
|
# More verbose logging
|
||||||
LOG_LEVEL=debug
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
2
.vscode/launch.template.jsonc
vendored
2
.vscode/launch.template.jsonc
vendored
@ -49,7 +49,7 @@
|
|||||||
"cwd": "${workspaceFolder}/backend",
|
"cwd": "${workspaceFolder}/backend",
|
||||||
"envFile": "${workspaceFolder}/.env",
|
"envFile": "${workspaceFolder}/.env",
|
||||||
"env": {
|
"env": {
|
||||||
"LOG_ALL_MODEL_INTERACTIONS": "True",
|
"LOG_DANSWER_MODEL_INTERACTIONS": "True",
|
||||||
"LOG_LEVEL": "DEBUG",
|
"LOG_LEVEL": "DEBUG",
|
||||||
"PYTHONUNBUFFERED": "1"
|
"PYTHONUNBUFFERED": "1"
|
||||||
},
|
},
|
||||||
|
@ -266,10 +266,14 @@ JOB_TIMEOUT = 60 * 60 * 6 # 6 hours default
|
|||||||
CURRENT_PROCESS_IS_AN_INDEXING_JOB = (
|
CURRENT_PROCESS_IS_AN_INDEXING_JOB = (
|
||||||
os.environ.get("CURRENT_PROCESS_IS_AN_INDEXING_JOB", "").lower() == "true"
|
os.environ.get("CURRENT_PROCESS_IS_AN_INDEXING_JOB", "").lower() == "true"
|
||||||
)
|
)
|
||||||
# Logs every model prompt and output, mostly used for development or exploration purposes
|
# Sets LiteLLM to verbose logging
|
||||||
LOG_ALL_MODEL_INTERACTIONS = (
|
LOG_ALL_MODEL_INTERACTIONS = (
|
||||||
os.environ.get("LOG_ALL_MODEL_INTERACTIONS", "").lower() == "true"
|
os.environ.get("LOG_ALL_MODEL_INTERACTIONS", "").lower() == "true"
|
||||||
)
|
)
|
||||||
|
# Logs Danswer only model interactions like prompts, responses, messages etc.
|
||||||
|
LOG_DANSWER_MODEL_INTERACTIONS = (
|
||||||
|
os.environ.get("LOG_DANSWER_MODEL_INTERACTIONS", "").lower() == "true"
|
||||||
|
)
|
||||||
# If set to `true` will enable additional logs about Vespa query performance
|
# If set to `true` will enable additional logs about Vespa query performance
|
||||||
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
||||||
LOG_VESPA_TIMING_INFORMATION = (
|
LOG_VESPA_TIMING_INFORMATION = (
|
||||||
|
@ -23,6 +23,7 @@ from langchain_core.messages.tool import ToolCallChunk
|
|||||||
from langchain_core.messages.tool import ToolMessage
|
from langchain_core.messages.tool import ToolMessage
|
||||||
|
|
||||||
from danswer.configs.app_configs import LOG_ALL_MODEL_INTERACTIONS
|
from danswer.configs.app_configs import LOG_ALL_MODEL_INTERACTIONS
|
||||||
|
from danswer.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS
|
||||||
from danswer.configs.model_configs import DISABLE_LITELLM_STREAMING
|
from danswer.configs.model_configs import DISABLE_LITELLM_STREAMING
|
||||||
from danswer.configs.model_configs import GEN_AI_API_ENDPOINT
|
from danswer.configs.model_configs import GEN_AI_API_ENDPOINT
|
||||||
from danswer.configs.model_configs import GEN_AI_API_VERSION
|
from danswer.configs.model_configs import GEN_AI_API_VERSION
|
||||||
@ -316,7 +317,7 @@ class DefaultMultiLLM(LLM):
|
|||||||
tools: list[dict] | None = None,
|
tools: list[dict] | None = None,
|
||||||
tool_choice: ToolChoiceOptions | None = None,
|
tool_choice: ToolChoiceOptions | None = None,
|
||||||
) -> BaseMessage:
|
) -> BaseMessage:
|
||||||
if LOG_ALL_MODEL_INTERACTIONS:
|
if LOG_DANSWER_MODEL_INTERACTIONS:
|
||||||
self.log_model_configs()
|
self.log_model_configs()
|
||||||
self._log_prompt(prompt)
|
self._log_prompt(prompt)
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ class DefaultMultiLLM(LLM):
|
|||||||
tools: list[dict] | None = None,
|
tools: list[dict] | None = None,
|
||||||
tool_choice: ToolChoiceOptions | None = None,
|
tool_choice: ToolChoiceOptions | None = None,
|
||||||
) -> Iterator[BaseMessage]:
|
) -> Iterator[BaseMessage]:
|
||||||
if LOG_ALL_MODEL_INTERACTIONS:
|
if LOG_DANSWER_MODEL_INTERACTIONS:
|
||||||
self.log_model_configs()
|
self.log_model_configs()
|
||||||
self._log_prompt(prompt)
|
self._log_prompt(prompt)
|
||||||
|
|
||||||
@ -361,7 +362,7 @@ class DefaultMultiLLM(LLM):
|
|||||||
"The AI model failed partway through generation, please try again."
|
"The AI model failed partway through generation, please try again."
|
||||||
)
|
)
|
||||||
|
|
||||||
if LOG_ALL_MODEL_INTERACTIONS and output:
|
if LOG_DANSWER_MODEL_INTERACTIONS and output:
|
||||||
content = output.content or ""
|
content = output.content or ""
|
||||||
if isinstance(output, AIMessage):
|
if isinstance(output, AIMessage):
|
||||||
if content:
|
if content:
|
||||||
|
@ -83,7 +83,9 @@ services:
|
|||||||
# https://docs.danswer.dev/more/telemetry
|
# https://docs.danswer.dev/more/telemetry
|
||||||
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
||||||
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
||||||
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # Log all of the prompts to the LLM
|
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging
|
||||||
|
# Log all of Danswer prompts and interactions with the LLM
|
||||||
|
- LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-}
|
||||||
# If set to `true` will enable additional logs about Vespa query performance
|
# If set to `true` will enable additional logs about Vespa query performance
|
||||||
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
||||||
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
||||||
@ -191,7 +193,9 @@ services:
|
|||||||
# https://docs.danswer.dev/more/telemetry
|
# https://docs.danswer.dev/more/telemetry
|
||||||
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
||||||
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
||||||
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # Log all of the prompts to the LLM
|
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging
|
||||||
|
# Log all of Danswer prompts and interactions with the LLM
|
||||||
|
- LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-}
|
||||||
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
||||||
|
|
||||||
# Enterprise Edition stuff
|
# Enterprise Edition stuff
|
||||||
|
@ -79,7 +79,9 @@ services:
|
|||||||
# https://docs.danswer.dev/more/telemetry
|
# https://docs.danswer.dev/more/telemetry
|
||||||
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
||||||
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
||||||
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # Log all of the prompts to the LLM
|
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging
|
||||||
|
# Log all of Danswer prompts and interactions with the LLM
|
||||||
|
- LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-}
|
||||||
# If set to `true` will enable additional logs about Vespa query performance
|
# If set to `true` will enable additional logs about Vespa query performance
|
||||||
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
# (time spent on finding the right docs + time spent fetching summaries from disk)
|
||||||
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
||||||
@ -183,7 +185,9 @@ services:
|
|||||||
# https://docs.danswer.dev/more/telemetry
|
# https://docs.danswer.dev/more/telemetry
|
||||||
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
|
||||||
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
- LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs
|
||||||
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # Log all of the prompts to the LLM
|
- LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging
|
||||||
|
# Log all of Danswer prompts and interactions with the LLM
|
||||||
|
- LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-}
|
||||||
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
- LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-}
|
||||||
|
|
||||||
# Enterprise Edition only
|
# Enterprise Edition only
|
||||||
|
@ -449,6 +449,7 @@ configMap:
|
|||||||
DISABLE_TELEMETRY: ""
|
DISABLE_TELEMETRY: ""
|
||||||
LOG_LEVEL: ""
|
LOG_LEVEL: ""
|
||||||
LOG_ALL_MODEL_INTERACTIONS: ""
|
LOG_ALL_MODEL_INTERACTIONS: ""
|
||||||
|
LOG_DANSWER_MODEL_INTERACTIONS: ""
|
||||||
LOG_VESPA_TIMING_INFORMATION: ""
|
LOG_VESPA_TIMING_INFORMATION: ""
|
||||||
# Shared or Non-backend Related
|
# Shared or Non-backend Related
|
||||||
WEB_DOMAIN: "http://localhost:3000" # for web server and api server
|
WEB_DOMAIN: "http://localhost:3000" # for web server and api server
|
||||||
|
@ -78,6 +78,7 @@ data:
|
|||||||
DISABLE_TELEMETRY: ""
|
DISABLE_TELEMETRY: ""
|
||||||
LOG_LEVEL: ""
|
LOG_LEVEL: ""
|
||||||
LOG_ALL_MODEL_INTERACTIONS: ""
|
LOG_ALL_MODEL_INTERACTIONS: ""
|
||||||
|
LOG_DANSWER_MODEL_INTERACTIONS: ""
|
||||||
LOG_VESPA_TIMING_INFORMATION: ""
|
LOG_VESPA_TIMING_INFORMATION: ""
|
||||||
# Shared or Non-backend Related
|
# Shared or Non-backend Related
|
||||||
INTERNAL_URL: "http://api-server-service:80" # for web server
|
INTERNAL_URL: "http://api-server-service:80" # for web server
|
||||||
|
Reference in New Issue
Block a user