Make custom access log class for worker and item class(es) for each proxy.
class CustomAccessLog(AccessLogBase):
user = Column(String)
class CustomGPTRequestItem(ChatGPTRequestItem):
def to_accesslog(self, accesslog_cls: _AccessLogBase) -> _AccessLogBase:
accesslog = super().to_accesslog(accesslog_cls)
# In this case, set value of "x-user-id" in request header to newly added colmun "user"
accesslog.user = self.request_headers.get("x-user-id")
return accesslog
# Use your custom accesslog
worker = CustomAccessLogWorker(accesslog_cls=CustomAccessLog)
# Use your custom request item
proxy = ChatGPTProxy(access_logger_queue=worker.queue_client, request_item_class=CustomGPTRequestItem)
Make custom access log class for worker and item class(es) for each proxy.