lyceum-env/clubs/chess/baml_src/chessmove.baml

49 lines
1.1 KiB
Text
Raw Permalink Normal View History

2024-10-12 20:06:49 +00:00
// Defining a data model.
class ChessMove {
piece_name PieceName
starting_square string
end_square string
is_capture bool
}
enum PieceName {
Pawn
Bishop
Knight
Rook
Queen
King
}
function ExtractChessMove(agent_string: string, board_state: string) -> ChessMove {
client Llama2
prompt #"
I will provide you with a text prompt. Based on this, you must first identify whether or not a chess move is described, and if yes then you must return the move.
The text is as follows:
{{ agent_string }}
{{ ctx.output_format }}
Here is also the current state of the board so you can understand the context of the text above.
{{ board_state }}
If the move does NOT contain a chess move, return
piece_name -> None
starting_square -> 'None'
end_square -> 'None'
is_capture -> 'False'
There are more ways that one to verify if you made a correct analysis, so for each correct one you will be rewarded.
Use Chain of Thought methods for this above analysis.
"#
}
// Test the function with a sample resume. Open the VSCode playground to run this.