MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / get_few_shot_example_messages

Function get_few_shot_example_messages

api/app/api/utils/few_shot_examples.py:10–26  ·  view source on GitHub ↗
(mode: str = "text_to_sql", scope="USA", n=-1)

Source from the content-addressed store, hash-verified

8
9
10def get_few_shot_example_messages(mode: str = "text_to_sql", scope="USA", n=-1) -> List[dict]:
11 examples = few_shot_examples.get(scope, {}).get(mode, [])
12 if n > 0:
13 examples = examples[:n]
14 if n == 0:
15 examples = []
16 messages = []
17 for example in examples:
18 messages.append({
19 "role": "user",
20 "content": example["user"],
21 })
22 messages.append({
23 "role": "assistant",
24 "content": example["assistant"],
25 })
26 return messages

Calls

no outgoing calls

Tested by

no test coverage detected