MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / log_input_classification

Function log_input_classification

api/app/api/utils/caesar_logging.py:100–125  ·  view source on GitHub ↗
(app_name, input_text, metadata, parent_id, session_id=None)

Source from the content-addressed store, hash-verified

98
99@failsoft
100def log_input_classification(app_name, input_text, metadata, parent_id, session_id=None):
101 if not EVENTS_ENGINE:
102 return None
103
104 params = {
105 "app_name": app_name,
106 "input_text": input_text,
107 "metadata": json.dumps(metadata),
108 "parent_id": parent_id,
109 "session_id": session_id
110 }
111
112 insert_query = text("""
113 INSERT INTO input_classifications (app_name, input_text, metadata, parent_id, session_id)
114 VALUES (:app_name, :input_text, :metadata, :parent_id, :session_id)
115 returning id
116 """)
117
118 with EVENTS_ENGINE.connect() as conn:
119 # get the ID back
120 result = conn.execute(insert_query, params)
121 conn.commit()
122 row = result.fetchone()
123 generation_id = row[0]
124
125 return str(generation_id)
126
127@failsoft
128def update_input_classification(id: str, ran_sql: bool, rows_returned: int, generated_sql: str):

Callers 1

create_labelsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected