Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Merge pull request #99 from openchatai/enable-logging
Browse files Browse the repository at this point in the history
Enable debug logging in the LLM server
  • Loading branch information
gharbat authored Sep 26, 2023
2 parents 74fcec8 + 83cc5ba commit 32f2f17
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions llm-server/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import warnings

import logging
import requests
import traceback

from flask import Flask, request
from langchain.chains.openai_functions import create_structured_output_chain
from langchain.chat_models import ChatOpenAI
Expand All @@ -17,6 +18,8 @@
from routes.workflow.typings.run_workflow_input import WorkflowData
from utils.detect_multiple_intents import hasMultipleIntents, hasSingleIntent

logging.basicConfig(level=logging.DEBUG)

app = Flask(__name__)

app.register_blueprint(workflow, url_prefix="/workflow")
Expand Down Expand Up @@ -69,7 +72,8 @@ def handle():
try:
json_output = try_to_match_and_call_api_endpoint(swagger_spec, text, headers)
except Exception as e:
warnings.warn(str(e))
logging.error(f"Failed to call or map API endpoint: {str(e)}")
logging.error("Exception traceback:\n" + traceback.format_exc())
json_output = None

llm = ChatOpenAI(model="gpt-3.5-turbo-0613", temperature=0)
Expand Down

0 comments on commit 32f2f17

Please sign in to comment.