Skip to content

Commit

Permalink
Fix FR issue
Browse files Browse the repository at this point in the history
  • Loading branch information
akshata29 committed Aug 1, 2023
1 parent 3ac77c8 commit ece444f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/Python/OpenChatGpt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def GetRrrAnswer(history, approach, overrides, indexNs, indexType):
tokenLength = overrides.get('tokenLength') or 500
firstSession = overrides.get('firstSession') or False
sessionId = overrides.get('sessionId')
promptTemplate = overrides.get('promptTemplate') or ''
promptTemplate = overrides.get('promptTemplate') or 'You are an AI assistant that helps people find information.'
deploymentType = overrides.get('deploymentType') or 'gpt35'
useInternet = overrides.get('useInternet') or False
os.environ['BING_SUBSCRIPTION_KEY'] = BingKey
Expand Down Expand Up @@ -303,7 +303,7 @@ def GetRrrAnswer(history, approach, overrides, indexNs, indexType):

tokenLimit = getTokenLimit(gptModel)
messages = getMessagesFromHistory(
"You are an AI assistant that helps people find information.",
promptTemplate,
gptModel,
history,
lastQuestion,
Expand Down
2 changes: 1 addition & 1 deletion api/Python/Utilities/formrecognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def chunk_paragraphs(paragraphs: List[str], fullPath:str, max_words: int = 300)
# start a new chunk
if (
sum([list(c.values())[0] for c in chunks[-1]]) + list(p.values())[0]
> max_words
> int(max_words)
):
chunks.append([p])
# If adding the next paragraph will not exceed the max word
Expand Down
12 changes: 11 additions & 1 deletion app/frontend/src/pages/chatgpt/ChatGpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@ const ChatGpt = () => {
});
setSessionListGpt(sessionLists)
}
let promptTemplate = "";
if (firstSession) {
if (selectedPromptTypeItemGpt?.key == "custom")
setPromptTemplateGpt(question);

promptTemplate = question;
}
else {
promptTemplate = promptTemplateGpt;
}
lastQuestionRefGpt.current = question;

error && setError(undefined);
Expand All @@ -385,7 +395,7 @@ const ChatGpt = () => {
history: [...history, { user: question, bot: undefined }],
approach: Approaches.ReadRetrieveRead,
overrides: {
promptTemplate: promptTemplateGpt.length === 0 ? undefined : promptTemplateGpt,
promptTemplate: promptTemplate,
temperature: temperatureGpt,
tokenLength: tokenLengthGpt,
embeddingModelType: String(selectedEmbeddingItemGpt?.key),
Expand Down
14 changes: 13 additions & 1 deletion app/frontend/src/pages/pib/Pib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,18 @@ const Pib = () => {
});
setSessionListGpt(sessionLists)
}

let promptTemplate = "";
if (firstSession) {
if (selectedPromptTypeItemGpt?.key == "custom")
setPromptTemplateGpt(question);

promptTemplate = question;
}
else {
promptTemplate = promptTemplateGpt;
}

lastQuestionRefGpt.current = question;

error && setError(undefined);
Expand All @@ -1216,7 +1228,7 @@ const Pib = () => {
history: [...history, { user: question, bot: undefined }],
approach: Approaches.ReadRetrieveRead,
overrides: {
promptTemplate: promptTemplateGpt.length === 0 ? undefined : promptTemplateGpt,
promptTemplate: promptTemplate,
temperature: temperatureGpt,
tokenLength: tokenLengthGpt,
embeddingModelType: String(selectedEmbeddingItemGpt?.key),
Expand Down

0 comments on commit ece444f

Please sign in to comment.