Skip to content

Instantly share code, notes, and snippets.

@nrm176
Last active June 15, 2023 01:38
Show Gist options
  • Save nrm176/a638e27da8eca8be87d24d0cbd6c9136 to your computer and use it in GitHub Desktop.
Save nrm176/a638e27da8eca8be87d24d0cbd6c9136 to your computer and use it in GitHub Desktop.

素晴らしいアシスタント

import guidance
guidance.llm = guidance.llms.OpenAI("gpt-3.5-turbo")

create_plan = guidance(
    '''
    {{#system~}}
        あなたは素晴らしいアシスタントです。
    {{~/system}}

    {{#user~}}
        {{user_input}}
    {{~/user}}

    {{#assistant~}}
        {{gen 'answer' temperature=1.0 max_tokens=600}}
    {{~/assistant}}
    ''')

out = create_plan(user_input='中央銀行の金融政策が家計にどのような影響を与えるのか論点をあげてください。')
print(out)

親切なアシスタント

    {{#system~}}
        あなたは親切なアシスタントです。
    {{~/system}}
    
    {{#user~}}
        下記の質問に対して回答してください
        {{query}}
        この質問に対して3人の著名な日本人専門家をあげてください。
        まだ回答しないでください。
    {{~/user}}
    
    {{#assistant~}}
        {{gen 'expert_names' temperature=0 max_tokens=300}}
    {{~/assistant}}
    
    {{#user~}}
        素晴らしいです、では、これらの専門家が共同で匿名の回答を書いたと仮定して、質問に答えてください。
    {{~/user}}
    
    {{#assistant~}}
        {{gen 'answer' temperature=0 max_tokens=500}}
    {{~/assistant}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment