Skip to content

Commit

Permalink
Add one-shot example (#4103)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwzeng1 authored Jun 23, 2024
1 parent ef78d6a commit ec7ccd7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion sweep_chat/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { Label } from './ui/label'
import PulsingLoader from './shared/PulsingLoader'
import {
DEFAULT_K,
DEFAULT_MODEL,
modelMap,
} from '@/lib/constants'
import {
Expand Down Expand Up @@ -116,7 +117,7 @@ function App({ defaultMessageId = '' }: { defaultMessageId?: string }) {
const [k, setK] = useLocalStorage<number>('k', DEFAULT_K)
const [model, setModel] = useLocalStorage<keyof typeof modelMap>(
'model',
'gpt-4o'
DEFAULT_MODEL
)
const [snippets, setSnippets] = useState<Snippet[]>([])
const [searchMessage, setSearchMessage] = useState<string>('')
Expand Down
2 changes: 2 additions & 0 deletions sweep_chat/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ const languageMapping: Record<string, Extension> = {
}

const DEFAULT_K: number = 8
const DEFAULT_MODEL = 'claude-3-5-sonnet-20240620'

export {
codeStyle,
modelMap,
DEFAULT_K,
DEFAULT_MODEL,
roleToColor,
typeNameToColor,
languageMapping,
Expand Down
17 changes: 14 additions & 3 deletions sweepai/chat/search_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,20 @@
[the function call goes here, using the valid XML format for function calls]
</function_call>""" + example_tool_calls

anthropic_format_message = """You MUST follow the following XML-based format, including <analysis> and <user_response> XML blocks:
anthropic_format_message = """### Guidelines
### Format
<examples>
If the user asks you to "Review this PR" or "Explain this PR", your organized response should contain the following sections:
Overview of the PR
Changes in file_1
Changes in file_2
Impact and purpose of the changes
</examples>
You MUST follow the following XML-based format, including <analysis> and <user_response> XML blocks:
### Format
<format>
You must respond with the following two distinct sections:
# 1. Summary and analysis
Expand All @@ -87,7 +97,8 @@
When showing relevant examples of code, only show MINIMAL excerpts of code that address the user's question. Do NOT copy the whole file, but only the lines that are relevant to the user's question.
To suggest code changes, first list each section of each file that you would like to change. Then for each section, write a <code_change> block for that change. These changes should be atomic -- to change multiple parts of the file, you MUST write multiple separate <code_change> blocks.
</user_response>"""
</user_response>
</format>"""

openai_format_message = """You MUST follow the following XML-based format, including <user_response> and </user_respose> tags:
Expand Down

0 comments on commit ec7ccd7

Please sign in to comment.