Skip to content

Commit

Permalink
fix(claude prompt): improved claude prompts and fix to model interfac…
Browse files Browse the repository at this point in the history
…e selection
  • Loading branch information
massi-ang authored and bigadsoleiman committed Mar 14, 2024
1 parent 9987059 commit b2840d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ def get_prompt(self):
return prompt_template

def get_condense_question_prompt(self):
template = """
template = """<conv>
{chat_history}
</conv>
Human: Given the above conversation and a follow up input, rephrase the follow up input to be a standalone question, in the same language as the follow up input.
Follow Up Input: {question}
<followup>
{question}
</followup>
Assistant:"""
Given the conversation inside the tags <conv></conv>, rephrase the follow up question you find inside <followup></followup> to be a standalone question, in the same language as the follow up question.
"""

return PromptTemplate(
input_variables=["chat_history", "question"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,17 @@ export default function ChatInputPanel(props: ChatInputPanelProps) {
}
}, [props.configuration]);

const hasImagesInChatHistory = function (): boolean {
return (
messageHistoryRef.current.filter(
(x) =>
x.type == ChatBotMessageType.Human &&
x.metadata?.files &&
(x.metadata.files as object[]).length > 0
).length > 0
);
};

const handleSendMessage = () => {
if (!state.selectedModel) return;
if (props.running) return;
Expand All @@ -331,9 +342,7 @@ export default function ChatInputPanel(props: ChatInputPanelProps) {
action: ChatBotAction.Run,
modelInterface:
(props.configuration.files && props.configuration.files.length > 0) ||
(messageHistoryRef.current.filter(
(x) => x.metadata?.files !== undefined
).length > 0 &&
(hasImagesInChatHistory() &&
state.selectedModelMetadata?.inputModalities.includes(
ChabotInputModality.Image
))
Expand All @@ -355,7 +364,7 @@ export default function ChatInputPanel(props: ChatInputPanelProps) {
},
},
};

console.log(request);
setState((state) => ({
...state,
value: "",
Expand Down

0 comments on commit b2840d7

Please sign in to comment.