ok so here's a very basic fewshot, it works fine:
```
import openai, transformers
client =
openai.OpenAI(api_key="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",
base_url='https://openrouter.ai/api/v1')
def complete(model, prompt, end):
completion = client.completions.create(model=model, prompt=prompt,
stop=end, temperature=0.0)
return completion.choices[0].text
class PrefixInfixSuffixAction:
template = 'Follow the examples:\n{left} => {right}\n'
model = 'deepseek-ai/DeepSeek-V3'
def run(self, pairs, example, template=template, model=model):
prefix, subtemplate = template.split('{left}',1)
infix, suffix = subtemplate.split('{right}',1)
prompt = prefix + suffix.join([str(left) + infix + str(right) for left,
right in pairs]) + str(example) + infix
return complete(model, prompt, suffix)
print(PrefixInfixSuffixAction().run([["1+1",2]],"9+7")) # outputs 16
```
now, ummmmmm say i want to make a prompt that does singleshot .... 1935 ... the
output is the structure used to perform the action; that would be the prompt.
so for example, "template" here is the prompt. the input is the behavior of the
action.
so if "9+7 => 16\n" were the _input_, then "Follow the examples:\n1+1 => 2\n"
would be the _output_, the second half of the pair.
Something that's missing here is:
- storage of data
- judging if data is good or bad, right or wrong