Spaces:
Running
Running
Upload 2 files
Browse files- agents/models/llms.py +46 -0
- agents/models/prompts.py +111 -0
agents/models/llms.py
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Pricing:
|
| 2 |
+
|
| 3 |
+
# https://platform.openai.com/docs/pricing
|
| 4 |
+
# https://ai.google.dev/gemini-api/docs/pricing
|
| 5 |
+
# https://claude.com/pricing#api
|
| 6 |
+
|
| 7 |
+
# CrewAI crew
|
| 8 |
+
|
| 9 |
+
LLM_CREW_PLANNING = "gpt-4.1-mini"
|
| 10 |
+
|
| 11 |
+
# CrewAI manager
|
| 12 |
+
|
| 13 |
+
LLM_MANAGER = "gpt-4.1-mini"
|
| 14 |
+
|
| 15 |
+
# CrewAI agents
|
| 16 |
+
|
| 17 |
+
LLM_AGENT = "gpt-4.1-mini"
|
| 18 |
+
|
| 19 |
+
# CrewAI tools
|
| 20 |
+
|
| 21 |
+
LLM_WEB_SEARCH = "gemini-3-pro-preview"
|
| 22 |
+
LLM_WEB_BROWSER = "claude-sonnet-4-5-latest"
|
| 23 |
+
LLM_IMAGE_ANALYSIS = "gemini-3-pro-preview"
|
| 24 |
+
LLM_AUDIO_ANALYSIS = "gemini-3-pro-preview"
|
| 25 |
+
LLM_VIDEO_ANALYSIS = "gemini-3-pro-preview"
|
| 26 |
+
LLM_YOUTUBE_ANALYSIS = "gemini-3-pro-preview"
|
| 27 |
+
LLM_DOCUMENT_ANALYSIS = "gemini-3-pro-preview"
|
| 28 |
+
LLM_CODE_GENERATION = "gemini-3-pro-preview"
|
| 29 |
+
LLM_CODE_EXECUTION = "gemini-3-pro-preview"
|
| 30 |
+
LLM_IMAGE_TO_FEN = "gemini-3-pro-preview"
|
| 31 |
+
LLM_ALGEBRAIC_NOTATION = "gemini-3-pro-preview"
|
| 32 |
+
|
| 33 |
+
THINKING_LEVEL_WEB_SEARCH = "low"
|
| 34 |
+
THINKING_LEVEL_MEDIA_ANALYSIS = "low"
|
| 35 |
+
THINKING_LEVEL_YOUTUBE_ANALYSIS = "low"
|
| 36 |
+
THINKING_LEVEL_DOCUMENT_ANALYSIS = "low"
|
| 37 |
+
THINKING_LEVEL_CODE_GENERATION = "high"
|
| 38 |
+
THINKING_LEVEL_CODE_EXECUTION = "low"
|
| 39 |
+
THINKING_LEVEL_IMAGE_TO_FEN = "high"
|
| 40 |
+
THINKING_LEVEL_ALGEBRAIC_NOTATION = "high"
|
| 41 |
+
|
| 42 |
+
# Other tools
|
| 43 |
+
|
| 44 |
+
LLM_FINAL_ANSWER = "gemini-3-pro-preview"
|
| 45 |
+
|
| 46 |
+
THINKING_LEVEL_FINAL_ANSWER = "low"
|
agents/models/prompts.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# References:
|
| 2 |
+
|
| 3 |
+
# https://claude.ai/public/artifacts/9d6efdeb-7c0d-4c8d-a71f-ba5c8f0da6e1
|
| 4 |
+
|
| 5 |
+
PROMPT_IMG_TO_FEN = """
|
| 6 |
+
You are an expert image to FEN generation assistant with highest attention to detail.
|
| 7 |
+
Given a user question, image of a chess position, and active color, your task is to generate the FEN of the image.
|
| 8 |
+
If the user question mentions not to move certain pieces, remove them from the FEN.
|
| 9 |
+
|
| 10 |
+
**Active Color**: {active_color}
|
| 11 |
+
|
| 12 |
+
**Rules:**
|
| 13 |
+
- Start from rank 8 to rank 1.
|
| 14 |
+
- For each rank, go from file a to file h.
|
| 15 |
+
- Use uppercase for white pieces: K=King, Q=Queen, R=Rook, B=Bishop, N=Knight, P=Pawn.
|
| 16 |
+
- Use lowercase for black pieces: k, q, r, b, n, p.
|
| 17 |
+
- Use numbers (1-8) for consecutive empty squares.
|
| 18 |
+
- Separate ranks with '/'.
|
| 19 |
+
- Provide all portions of the FEN, including active color, castling rights, en passant, and move counters.
|
| 20 |
+
- Return ONLY the FEN, nothing else.
|
| 21 |
+
|
| 22 |
+
**Examples:**
|
| 23 |
+
|
| 24 |
+
**FEN**: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
|
| 25 |
+
|
| 26 |
+
**FEN**: r1bq1rk1/pp1n1ppp/2p1pn2/3p4/3P4/2N1PN2/PPQ2PPP/R1B2RK1 w KQ - 4 12
|
| 27 |
+
|
| 28 |
+
**FEN**: r1bqkb1r/pppp1ppp/2n2n2/4p3/2B1P3/8/PPPP1PPP/RNBQK1NR b KQkq - 0 4
|
| 29 |
+
|
| 30 |
+
**FEN**: rnbqkbnr/ppp1pppp/8/8/3pP3/8/PPP2PPP/RNBQKBNR b KQkq d3 0 2
|
| 31 |
+
|
| 32 |
+
**FEN**: 8/6p1/5K2/8/8/8/7k/8 w - - 0 1
|
| 33 |
+
|
| 34 |
+
**User Question:** {question}
|
| 35 |
+
|
| 36 |
+
**FEN:**
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
PROMPT_ALGEBRAIC_NOTATION = """
|
| 40 |
+
You are an expert algebraic chess notation (aka standard notation) generation assistant with highest attention to detail.
|
| 41 |
+
Given a user question, image of a chess position, and position evaluation in UCI notation, your task is to answer the question in algebraic chess notation.
|
| 42 |
+
Only provide your answer, no explanation.
|
| 43 |
+
|
| 44 |
+
**Position Evaluation in UCI Notation**: {position_evaluation}
|
| 45 |
+
|
| 46 |
+
**Rules:**
|
| 47 |
+
- Each move lists the piece letter (K, Q, R, B, N). Pawns are written with no letter.
|
| 48 |
+
- The destination square (file + rank) always appears (e.g., e4, c6).
|
| 49 |
+
- Captures use an "x" before the destination (e.g., Bxe5, exd5).
|
| 50 |
+
- Checks add "+", checkmate adds "#".
|
| 51 |
+
- Castling is written as O-O (king-side) or O-O-O (queen-side).
|
| 52 |
+
- Pawn promotion adds "=Piece" after the move (e.g., e8=Q).
|
| 53 |
+
- If two identical pieces can go to the same square, the move is disambiguated with file or rank (e.g., Nbd2 or R1e2).
|
| 54 |
+
- En passant is recorded like a standard capture (e.g., exd6 e.p.).
|
| 55 |
+
|
| 56 |
+
**Examples:**
|
| 57 |
+
|
| 58 |
+
**Algebraic Chess Notation:** Qxb1, Ra8#
|
| 59 |
+
|
| 60 |
+
**Algebraic Chess Notation:** R1e2
|
| 61 |
+
|
| 62 |
+
**Algebraic Chess Notation:** Nf3+
|
| 63 |
+
|
| 64 |
+
**User Question:** {question}
|
| 65 |
+
|
| 66 |
+
**Algebraic Chess Notation:**
|
| 67 |
+
"""
|
| 68 |
+
|
| 69 |
+
PROMPT_FINAL_ANSWER = """
|
| 70 |
+
You are an expert final answer generation assistant with highest attention to detail.
|
| 71 |
+
Given a question and an initial answer, your task is to generate the final answer.
|
| 72 |
+
|
| 73 |
+
**Rules:**
|
| 74 |
+
- The final answer must be a number and/or string OR as few words as possible OR a comma-separated list of numbers and/or strings.
|
| 75 |
+
- If you are asked for a number, don't use comma to write your number neither use units such as USD, $, percent, or % unless specified otherwise.
|
| 76 |
+
- If you are asked for a string, don't use articles, neither abbreviations (for example cities), and write the digits in plain text unless specified otherwise.
|
| 77 |
+
- If you are asked for a comma-separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 78 |
+
- If the final answer is a number, use a number not a word.
|
| 79 |
+
- If the final answer is a string, start with an uppercase character.
|
| 80 |
+
- If the final answer is a comma-separated list of numbers, use a space character after each comma.
|
| 81 |
+
- If the final answer is a comma-separated list of strings, use a space character after each comma and start with a lowercase character.
|
| 82 |
+
- Do not add any content to the final answer that is not in the initial answer.
|
| 83 |
+
|
| 84 |
+
**Examples:**
|
| 85 |
+
|
| 86 |
+
**Question:** What is the biggest city in California?
|
| 87 |
+
**Initial Answer:** The biggest city in California is Los Angeles.
|
| 88 |
+
**Final Answer:** Los Angeles
|
| 89 |
+
|
| 90 |
+
**Question:** How many 'r's are in strawberry?
|
| 91 |
+
**Initial Answer:** There are 3 'r's in strawberry.
|
| 92 |
+
**Final Answer:** 3
|
| 93 |
+
|
| 94 |
+
**Question:** What is the opposite of black?
|
| 95 |
+
**Initial Answer:** The opposite of black is white.
|
| 96 |
+
**Final Answer:** White
|
| 97 |
+
|
| 98 |
+
**Question:** What are the first 5 numbers in the Fibonacci sequence?
|
| 99 |
+
**Initial Answer:** The first 5 numbers in the Fibonacci sequence are 0, 1, 1, 2, 3.
|
| 100 |
+
**Final Answer:** 0, 1, 1, 2, 3
|
| 101 |
+
|
| 102 |
+
**Question:** What is the opposite of bad, worse, worst?
|
| 103 |
+
**Initial Answer:** The opposite of bad, worse, worst is good, better, best.
|
| 104 |
+
**Final Answer:** good, better, best
|
| 105 |
+
|
| 106 |
+
**Question:** {question}
|
| 107 |
+
|
| 108 |
+
**Initial Answer:** {answer}
|
| 109 |
+
|
| 110 |
+
**Final Answer:**
|
| 111 |
+
"""
|