OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
import {
type UseQueryOptions,
useQuery,
useQueryClient,
} from "@tanstack/react-query";
import type { FunctionCall } from "@/app/chat/_types/types";
import { apiClient } from "@/lib/api-client";
export interface AgentSettings {
llm_model?: string;
llm_provider?: string;
system_prompt?: string;
default_system_prompt?: string;
}
export interface KnowledgeSettings {
embedding_model?: string;
embedding_provider?: string;
chunk_size?: number;
chunk_overlap?: number;
table_structure?: boolean;
ocr?: boolean;
ocr_languages?: string[];
picture_descriptions?: boolean;
disable_ingest_with_langflow?: boolean;
vlm_enabled?: boolean;
vlm_provider?: string;
vlm_model?: string;
vlm_prompt?: string;
vlm_response_format?: string;
vlm_max_tokens?: number;
vlm_concurrency?: number;
vlm_timeout?: number;
vlm_watsonx_api_version?: string;
}
export interface ProviderSettings {
openai?: {
has_api_key?: boolean;
configured?: boolean;
};
anthropic?: {
has_api_key?: boolean;
configured?: boolean;
};
watsonx?: {
has_api_key?: boolean;
endpoint?: string;
project_id?: string;
configured?: boolean;
};
ollama?: {
endpoint?: string;
configured?: boolean;
};
local?: {
configured?: boolean;
};
custom?: Record<
string,
{
configured?: boolean;
credential_values?: Record<string, string>;
secret_fields?: string[];
auth_method?: string | null;
}
>;
}
export interface OnboardingState {
current_step?: number;
assistant_message?: {
role: string;
content: string;
timestamp: string;
functionCalls?: FunctionCall[] | null;
} | null;
selected_nudge?: string | null;
card_steps?: Record<string, unknown> | null;
upload_steps?: Record<string, unknown> | null;
openrag_docs_filter_id?: string | null;
user_doc_filter_id?: string | null;
}
export interface Settings {
langflow_url?: string;
flow_id?: string;
ingest_flow_id?: string;
langflow_public_url?: string;
edited?: boolean;
onboarding?: OnboardingState;
providers?: ProviderSettings;
knowledge?: KnowledgeSettings;
agent?: AgentSettings;
langflow_edit_url?: string;
langflow_ingest_edit_url?: string;
ingestion_defaults?: {
chunkSize?: number;
chunkOverlap?: number;
separator?: string;
embeddingModel?: string;
};
localhost_url?: string;
ingest_via_chat?: boolean;
show_provider_ingest_settings?: boolean;
show_vlm_settings?: boolean;
local_vlm_models?: string[];
show_shared_upload_toggle?: boolean;
show_url_connector?: boolean;
show_workspace_oauth_overrides?: boolean;
segment_write_key?: string;
environment?: string;
langflow_port?: string | number | null;
}
export async function getSettings(): Promise<Settings> {
const response = await apiClient.get<Settings>("/settings");
if (response.status >= 200 && response.status < 300) {
return response.data;
} else {
throw new Error("Failed to fetch settings");
}
}
export const useGetSettingsQuery = (
options?: Omit<UseQueryOptions<Settings>, "queryKey" | "queryFn">,
) => {
const queryClient = useQueryClient();
return useQuery(
{
queryKey: ["settings"],
queryFn: getSettings,
...options,
},
queryClient,
);
};