Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…openai-demo-java into sk-vector-stores
  • Loading branch information
milderhc committed Dec 4, 2024
2 parents c57efea + 8dc9227 commit 80a5d96
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
mv ./target/$originaljarname ./target/app.jar
- name: Upload artifacts for backend deployment jobs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: spring-boot-app
path: |
Expand All @@ -86,7 +86,7 @@ jobs:

steps:
- name: Download backend artifact from build job
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4.1.7
with:
name: spring-boot-app
path: ./backend
Expand Down
62 changes: 31 additions & 31 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@fluentui/react-components": "^9.37.3",
"@fluentui/react-icons": "^2.0.221",
"@react-spring/web": "^9.7.3",
"dompurify": "^3.0.6",
"dompurify": "^3.1.3",
"frontend": "file:",
"ndjson-readablestream": "^1.0.7",
"react": "^18.2.0",
Expand All @@ -33,6 +33,6 @@
"@vitejs/plugin-react": "^4.1.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vite": "^4.5.3"
"vite": "^4.5.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.microsoft.openai.samples.indexer;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;

import com.microsoft.openai.samples.indexer.index.SearchIndexManager;
import com.microsoft.openai.samples.indexer.parser.PDFParser;
import com.microsoft.openai.samples.indexer.parser.Page;
import com.microsoft.openai.samples.indexer.parser.TextSplitter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;

/**
* The DocumentProcessor class is responsible for processing and indexing documents.
* It takes a document as input, either as a file or as a byte array, and processes it for indexing.
Expand Down Expand Up @@ -47,6 +46,7 @@ public void indexDocumentfromFile(String filepath, String category) throws IOExc

public void indexDocumentFromBytes(String filename, String category, byte[] content){
logger.debug("Indexing file {}", filename);

//TODO add support for other file types (docx, pptx, txt, md, html, etc)
List<Page> pages = pdfParser.parse(content);
logger.info("Found {} pages in file {}", pages.size(), filename);
Expand Down
17 changes: 10 additions & 7 deletions deploy/aca/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ param formRecognizerResourceGroupLocation string = location
param formRecognizerSkuName string = 'S0'

param chatGptDeploymentName string // Set in main.parameters.json
param chatGptDeploymentCapacity int = 60
param chatGptModelName string = 'gpt-35-turbo'
param chatGptModelVersion string = '0613'
param chatGptDeploymentCapacity int = 80
param chatGptDeploymentSkuName string= 'Standard'
param chatGptModelName string = 'gpt-4o-mini'
param chatGptModelVersion string = '2024-07-18'
param embeddingDeploymentName string // Set in main.parameters.json
param embeddingDeploymentCapacity int = 80
param embeddingModelName string = 'text-embedding-ada-002'
param embeddingDeploymentCapacity int = 120

param embeddingModelName string = 'text-embedding-3-small'
param embeddingModelVersion string = '1'

param servicebusNamespace string = ''
param serviceBusSkuName string = 'Standard'
Expand Down Expand Up @@ -307,7 +310,7 @@ module openAi '../../shared/ai/cognitiveservices.bicep' = {
version: chatGptModelVersion
}
sku: {
name: 'Standard'
name: chatGptDeploymentSkuName
capacity: chatGptDeploymentCapacity
}
}
Expand All @@ -316,7 +319,7 @@ module openAi '../../shared/ai/cognitiveservices.bicep' = {
model: {
format: 'OpenAI'
name: embeddingModelName
version: '2'
version: embeddingModelVersion
}
sku: {
name: 'Standard'
Expand Down
23 changes: 19 additions & 4 deletions deploy/aca/infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,31 @@
"value": "${AZURE_STORAGE_SKU=Standard_LRS}"
},
"chatGptModelName": {
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-35-turbo}"
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-4o-mini}"
},
"chatGptModelVersion": {
"value": "${AZURE_OPENAI_CHATGPT_VERSION=0613}"
"value": "${AZURE_OPENAI_CHATGPT_VERSION=2024-07-18}"
},
"chatGptDeploymentName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=chat}"
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-4o-mini}"
},
"chatGptDeploymentCapacity": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY=80}"
},
"chatGptDeploymentSkuName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_SKU_NAME=Standard}"
},
"embeddingModelName": {
"value": "${AZURE_OPENAI_EMB_MODEL=text-embedding-3-small}"
},
"embeddingModelVersion": {
"value": "${AZURE_OPENAI_EMB_MODEL_VERSION=1}"
},
"embeddingDeploymentName": {
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT=embedding}"
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT=text-embedding-3-small}"
},
"embeddingDeploymentCapacity": {
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY=120}"
},
"useApplicationInsights": {
"value": "${AZURE_USE_APPLICATION_INSIGHTS=true}"
Expand Down
17 changes: 10 additions & 7 deletions deploy/aks/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ param formRecognizerResourceGroupLocation string = location
param formRecognizerSkuName string = 'S0'

param chatGptDeploymentName string // Set in main.parameters.json
param chatGptDeploymentCapacity int = 60
param chatGptModelName string = 'gpt-35-turbo'
param chatGptModelVersion string = '0613'
param chatGptDeploymentCapacity int = 80
param chatGptModelName string = 'gpt-4o-mini'
param chatGptModelVersion string = '2024-07-18'
param chatGptDeploymentSkuName string= 'Standard'

param embeddingDeploymentName string // Set in main.parameters.json
param embeddingDeploymentCapacity int = 80
param embeddingModelName string = 'text-embedding-ada-002'
param embeddingDeploymentCapacity int = 120
param embeddingModelName string = 'text-embedding-3-small'
param embeddingModelVersion string = '1'

param servicebusNamespace string = ''
param serviceBusSkuName string = 'Standard'
Expand Down Expand Up @@ -177,7 +180,7 @@ module openAi '../../shared/ai/cognitiveservices.bicep' = if (openAiHost == 'azu
version: chatGptModelVersion
}
sku: {
name: 'Standard'
name: chatGptDeploymentSkuName
capacity: chatGptDeploymentCapacity
}
}
Expand All @@ -186,7 +189,7 @@ module openAi '../../shared/ai/cognitiveservices.bicep' = if (openAiHost == 'azu
model: {
format: 'OpenAI'
name: embeddingModelName
version: '2'
version: embeddingModelVersion
}
sku: {
name: 'Standard'
Expand Down
23 changes: 19 additions & 4 deletions deploy/aks/infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,31 @@
"value": "${AZURE_STORAGE_SKU=Standard_LRS}"
},
"chatGptModelName": {
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-35-turbo}"
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-4o-mini}"
},
"chatGptModelVersion": {
"value": "${AZURE_OPENAI_CHATGPT_VERSION=0613}"
"value": "${AZURE_OPENAI_CHATGPT_VERSION=2024-07-18}"
},
"chatGptDeploymentName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=chat}"
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-4o-mini}"
},
"chatGptDeploymentCapacity": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY=80}"
},
"chatGptDeploymentSkuName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_SKU_NAME=Standard}"
},
"embeddingModelName": {
"value": "${AZURE_OPENAI_EMB_MODEL=text-embedding-3-small}"
},
"embeddingModelVersion": {
"value": "${AZURE_OPENAI_EMB_MODEL_VERSION=1}"
},
"embeddingDeploymentName": {
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT=embedding}"
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT=text-embedding-3-small}"
},
"embeddingDeploymentCapacity": {
"value": "${AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY=120}"
},
"openAiHost":{
"value": "${OPENAI_HOST=azure}"
Expand Down
Loading

0 comments on commit 80a5d96

Please sign in to comment.