-
Notifications
You must be signed in to change notification settings - Fork 2
Standardize Azure environment configuration and harden blob/search/OpenAI client initialization for TriResolve-AI project #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4d35405
c8bbeb3
364257b
610f08e
287397d
ebf5d77
98ee1d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # ─── Server ────────────────────────────────────────────────────────────────── | ||
| PORT=3000 | ||
|
|
||
| # Set to "true" to enable /audit-log and /audit-log/schema endpoints | ||
| AUDIT_LOG_ENABLED=false | ||
|
|
||
| # ─── Azure OpenAI ───────────────────────────────────────────────────────────── | ||
| # Your Azure OpenAI resource endpoint (e.g. https://<resource>.openai.azure.com) | ||
| AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com | ||
| # API key from your Azure OpenAI resource > Keys and Endpoint | ||
| AZURE_OPENAI_KEY=<your-azure-openai-key> | ||
| # Chat/completions deployment name (must match the deployment name in Azure AI Studio, not the base model name) | ||
| AZURE_OPENAI_DEPLOYMENT=gpt-4o | ||
| # Embeddings deployment name | ||
| AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-ada-002 | ||
| # Azure OpenAI REST API version | ||
| AZURE_OPENAI_API_VERSION=2024-12-01 | ||
|
|
||
| # ─── Azure AI Search ────────────────────────────────────────────────────────── | ||
| # Endpoint for your Azure AI Search service (e.g. https://<service>.search.windows.net) | ||
| AZURE_SEARCH_ENDPOINT=https://<your-search-service>.search.windows.net | ||
| # Admin or query API key from your Search service > Keys | ||
| AZURE_SEARCH_KEY=<your-search-api-key> | ||
| # Name of the search index (must match between runtime and ingest script) | ||
| AZURE_SEARCH_INDEX=cg-knowledge-index | ||
| # Azure AI Search REST API version (used by root searchService.js) | ||
| AZURE_SEARCH_API_VERSION=2023-11-01 | ||
|
|
||
| # ─── Azure Blob Storage ─────────────────────────────────────────────────────── | ||
| # Full connection string from Storage Account > Access Keys | ||
| AZURE_BLOB_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=<account>;AccountKey=<key>;EndpointSuffix=core.windows.net | ||
| # Container name (used by both document storage and audit log service) | ||
| # Document upload/ingest uses this container for raw documents; audit service appends to audit_log_live.jsonl here | ||
| AZURE_BLOB_CONTAINER_NAME=<your-container-name> | ||
|
|
||
| # ─── Azure Document Intelligence ───────────────────────────────────────────── | ||
| # Required for PDF text extraction during document ingestion | ||
| AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=https://<your-resource>.cognitiveservices.azure.com | ||
| AZURE_DOCUMENT_INTELLIGENCE_API_KEY=<your-doc-intelligence-key> | ||
|
|
||
| # ─── Audit log blob name (optional) ────────────────────────────────────────── | ||
| # Defaults to "audit_log_live.jsonl" — matches the blob already in the storage container | ||
| AUDIT_LOG_BLOB=audit_log_live.jsonl | ||
|
|
||
| # ─── Frontend ───────────────────────────────────────────────────────────────── | ||
| # Backend API base URL consumed by Vite (frontend/src/App.jsx via import.meta.env.VITE_API_URL) | ||
| # Set this in frontend/.env for local dev, or in your deployment environment | ||
| VITE_API_URL=http://localhost:3000 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ class OpenAIService { | |||||
| constructor() { | ||||||
| this.client = openaiClient; | ||||||
| this.embeddingDeployment = process.env.AZURE_OPENAI_EMBEDDING_DEPLOYMENT || "text-embedding-ada-002"; | ||||||
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4"; | ||||||
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4o"; | ||||||
|
||||||
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4o"; | |
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-35-turbo-instruct"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@megan-nepshinsky will you check this comment please. GPT‑4o is the correct deployment but I am not sure how your code is setup and don't want to break anything. I am also not sure as to how @steffahv may have wired the chat deployments in the background either. So I just want to make sure before making any changes.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Backend API base URL — used by Vite via import.meta.env.VITE_API_URL | ||
| # Copy this file to frontend/.env and update the value for your environment | ||
| VITE_API_URL=http://localhost:3000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLocalFallbackEnabled()only checksAZURE_BLOB_CONNECTION_STRING. If an environment still uses the legacyAZURE_STORAGE_CONNECTION_STRING, this will incorrectly enable the local fallback and bypass Blob storage even though Blob is configured. Update the check to treat Blob as configured when either env var is set (same fallback logic used elsewhere).