Skip to content

Commit

Permalink
Merge pull request #714 from helixml/disable_llm_calls_logging
Browse files Browse the repository at this point in the history
Disable llm calls logging
  • Loading branch information
nessie993 authored Jan 15, 2025
2 parents 182401f + 85d8f90 commit a0b16fc
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
17 changes: 7 additions & 10 deletions api/cmd/helix/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,20 +282,17 @@ func serve(cmd *cobra.Command, cfg *config.ServerConfig) error {

helixInference := openai.NewInternalHelixServer(cfg, ps, scheduler)

// controllerOpenAIClient, err := createOpenAIClient(cfg, helixInference)
// if err != nil {
// return err
// }

logStores := []logger.LogStore{
store,
// TODO: bigquery
var logStores []logger.LogStore

if !cfg.DisableLLMCallLogging {
logStores = []logger.LogStore{
store,
// TODO: bigquery
}
}

providerManager := manager.NewProviderManager(cfg, helixInference, logStores...)

// controllerOpenAIClient = logger.Wrap(cfg, controllerOpenAIClient, logStores...)

dataprepOpenAIClient, err := createDataPrepOpenAIClient(cfg, helixInference)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions api/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type ServerConfig struct {
Apps Apps
GPTScript GPTScript
Triggers Triggers

DisableLLMCallLogging bool `envconfig:"DISABLE_LLM_CALL_LOGGING" default:"false"`
}

func LoadServerConfig() (ServerConfig, error) {
Expand Down
3 changes: 3 additions & 0 deletions api/pkg/server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func (apiServer *HelixAPIServer) getConfig() (types.ServerConfigForFrontend, err
RudderStackDataPlaneURL: apiServer.Cfg.Janitor.RudderStackDataPlaneURL,
ToolsEnabled: apiServer.Cfg.Tools.Enabled,
AppsEnabled: apiServer.Cfg.Apps.Enabled,
DisableLLMCallLogging: apiServer.Cfg.DisableLLMCallLogging,
Version: data.GetHelixVersion(),
}, nil
}
Expand All @@ -222,11 +223,13 @@ func (apiServer *HelixAPIServer) configJS(res http.ResponseWriter, _ *http.Reque
}
res.Header().Set("Content-Type", "application/javascript")
content := fmt.Sprintf(`
window.DISABLE_LLM_CALL_LOGGING = %t
window.HELIX_SENTRY_DSN = "%s"
window.HELIX_GOOGLE_ANALYTICS = "%s"
window.RUDDERSTACK_WRITE_KEY = "%s"
window.RUDDERSTACK_DATA_PLANE_URL = "%s"
`,
config.DisableLLMCallLogging,
config.SentryDSNFrontend,
config.GoogleAnalyticsFrontend,
config.RudderStackWriteKey,
Expand Down
1 change: 1 addition & 0 deletions api/pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ type ServerConfigForFrontend struct {
AppsEnabled bool `json:"apps_enabled"`
RudderStackWriteKey string `json:"rudderstack_write_key"`
RudderStackDataPlaneURL string `json:"rudderstack_data_plane_url"`
DisableLLMCallLogging bool `json:"disable_llm_call_logging"`
Version string `json:"version"`
}

Expand Down
16 changes: 12 additions & 4 deletions frontend/src/components/app/AppLogsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ interface AppLogsTableProps {
appId: string;
}

const win = (window as any)

const AppLogsTable: FC<AppLogsTableProps> = ({ appId }) => {
const api = useApi();
const [llmCalls, setLLMCalls] = useState<PaginatedLLMCalls | null>(null);
Expand Down Expand Up @@ -112,8 +114,13 @@ const AppLogsTable: FC<AppLogsTableProps> = ({ appId }) => {
</TableRow>
</TableHead>
<TableBody>
{llmCalls.calls.map((call: LLMCall) => (
<TableRow key={call.id}>
{ win.DISABLE_LLM_CALL_LOGGING ? (
<TableRow>
<TableCell colSpan={6}>LLM call logging is disabled by the administrator.</TableCell>
</TableRow>
) : (
llmCalls.calls.map((call: LLMCall) => (
<TableRow key={call.id}>
<TableCell>{new Date(call.created).toLocaleString()}</TableCell>
<TableCell>{call.session_id}</TableCell>
<TableCell>{call.step || 'n/a'}</TableCell>
Expand All @@ -128,8 +135,9 @@ const AppLogsTable: FC<AppLogsTableProps> = ({ appId }) => {
<TableCell>
<Button onClick={() => handleOpenModal(call.response, call)}>View</Button>
</TableCell>
</TableRow>
))}
</TableRow>
))
)}
</TableBody>
</Table>
</TableContainer>
Expand Down
18 changes: 13 additions & 5 deletions frontend/src/components/dashboard/LLMCallsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const LLMCallsTable: FC<LLMCallsTableProps> = ({ sessionFilter }) => {
const [modalContent, setModalContent] = useState<any>(null);
const [modalOpen, setModalOpen] = useState(false);

const win = (window as any)

const fetchLLMCalls = async () => {
try {
const queryParams = new URLSearchParams({
Expand Down Expand Up @@ -99,9 +101,14 @@ const LLMCallsTable: FC<LLMCallsTableProps> = ({ sessionFilter }) => {
</TableRow>
</TableHead>
<TableBody>
{llmCalls.calls.map((call: LLMCall) => (
<TableRow key={call.id}>
<TableCell>{call.id}</TableCell>
{ win.DISABLE_LLM_CALL_LOGGING ? (
<TableRow>
<TableCell colSpan={6}>LLM call logging is disabled by the administrator.</TableCell>
</TableRow>
) : (
llmCalls.calls.map((call: LLMCall) => (
<TableRow key={call.id}>
<TableCell>{call.id}</TableCell>
<TableCell>{new Date(call.created).toLocaleString()}</TableCell>
<TableCell>{call.session_id}</TableCell>
<TableCell>{call.interaction_id}</TableCell>
Expand All @@ -120,8 +127,9 @@ const LLMCallsTable: FC<LLMCallsTableProps> = ({ sessionFilter }) => {
<TableCell>
<Button onClick={() => handleOpenModal(call.response)}>View</Button>
</TableCell>
</TableRow>
))}
</TableRow>
))
)}
</TableBody>
</Table>
</TableContainer>
Expand Down

0 comments on commit a0b16fc

Please sign in to comment.