-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add customised prompts for chat view
- Loading branch information
1 parent
c66aa52
commit 6b0e46b
Showing
46 changed files
with
179 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Sure! Here is a Python implementation of Kadane's algorithm: | ||
|
||
```python | ||
def kadane_algorithm(arr): | ||
max_sum = float('-inf') | ||
current_sum = 0 | ||
|
||
for num in arr: | ||
current_sum = max(num, current_sum + num) | ||
max_sum = max(max_sum, current_sum) | ||
|
||
return max_sum | ||
|
||
# Example usage | ||
arr = [-2, 1, -3, 4, -1, 2, 1, -5, 4] | ||
print(kadane_algorithm(arr)) # Output: 6 | ||
``` | ||
|
||
This implementation finds the maximum sum of a contiguous subarray within the given array arr using Kadane's algorithm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Show me a Python implementation of Kadane's algorithm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
The Navier-Stokes equation is given by: | ||
|
||
$$ | ||
\rho \left( \frac{\partial \textbf{u}}{\partial t} + \textbf{u} \cdot \nabla \textbf{u} \right) = - \nabla p + \mu \nabla^2 \textbf{u} + \textbf{f} | ||
$$ | ||
|
||
where: | ||
|
||
- $\rho$ is the fluid density, | ||
- $\textbf{u}$ is the fluid velocity vector, | ||
- $t$ is time, | ||
- $p$ is the pressure, | ||
- $\mu$ is the dynamic viscosity, | ||
- $\nabla$ is the gradient operator, | ||
- $\nabla^2$ is the Laplacian operator, and | ||
- $\textbf{f}$ is the external force per unit volume. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Show me the Navier-Stokes equation using LaTeX. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { FewShotPrompt } from '..'; | ||
import example1Assistant from './example1/assistant.md'; | ||
import example1User from './example1/user.md'; | ||
import example2Assistant from './example2/assistant.md'; | ||
import example2User from './example2/user.md'; | ||
import system from './system.txt'; | ||
|
||
export const CHAT_PROMPT: FewShotPrompt = { | ||
system, | ||
examples: [ | ||
{ | ||
user: example1User, | ||
assistant: example1Assistant, | ||
}, | ||
{ | ||
user: example2User, | ||
assistant: example2Assistant, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Answer the user's question. | ||
Code blocks must be formatted using triple backticks (```), and the language name must be specified. | ||
Math blocks must be formatted using double dollar signs ($$). | ||
Inline math must be formatted using single dollar signs ($). |
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/api/prompts/list-item/index.ts → .../prompts/completions/block-quote/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/api/prompts/math-block/index.ts → src/api/prompts/completions/heading/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/api/prompts/block-quote/index.ts → ...pi/prompts/completions/list-item/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/api/prompts/heading/index.ts → ...i/prompts/completions/math-block/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/api/prompts/paragraph/index.ts → ...pi/prompts/completions/paragraph/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.