[GH-ISSUE #2154] How to design our own prompt by import ollama? #1228

Closed
opened 2026-04-12 11:00:07 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @haomes on GitHub (Jan 23, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2154

假如我想设计一个CR相关的prompt(比如:你是一个CR专家,请帮我根据提供的代码判断是否符标准...),并且通过 import ollama的python方法去调用大模型,我应该如何操作?

Originally created by @haomes on GitHub (Jan 23, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2154 假如我想设计一个CR相关的prompt(比如:你是一个CR专家,请帮我根据提供的代码判断是否符标准...),并且通过 import ollama的python方法去调用大模型,我应该如何操作?
Author
Owner

@jukofyork commented on GitHub (Jan 24, 2024):

假如我想设计一个CR相关的prompt(比如:你是一个CR专家,请帮我根据提供的代码判断是否符标准...),并且通过 import ollama的python方法去调用大模型,我应该如何操作?

I used google translate so apologize if this is wrong:

If I want to design a CR-related prompt (for example: you are a CR expert, please help me judge whether it meets the standards based on the code provided...), and call the large model through the python method of import ollama, how should I operate?

https://github.com/ollama/ollama/blob/main/docs/modelfile.md#system

eg:

SYSTEM """You are a CR expert, please help me judge whether it meets the standards based on the code provided."""

SYSTEM """你是一个CR专家, 请帮我根据提供的代码判断是否符标准."""

<!-- gh-comment-id:1907927986 --> @jukofyork commented on GitHub (Jan 24, 2024): > 假如我想设计一个CR相关的prompt(比如:你是一个CR专家,请帮我根据提供的代码判断是否符标准...),并且通过 import ollama的python方法去调用大模型,我应该如何操作? I used google translate so apologize if this is wrong: > If I want to design a CR-related prompt (for example: you are a CR expert, please help me judge whether it meets the standards based on the code provided...), and call the large model through the python method of import ollama, how should I operate? https://github.com/ollama/ollama/blob/main/docs/modelfile.md#system eg: `SYSTEM """You are a CR expert, please help me judge whether it meets the standards based on the code provided."""` `SYSTEM """你是一个CR专家, 请帮我根据提供的代码判断是否符标准."""`
Author
Owner

@mchiang0610 commented on GitHub (Mar 12, 2024):

要改prompt 大约可以这样

import ollama
response = ollama.chat(model='llama2', messages=[
  {
    'role': 'user',
    'content': '你是一个CR专家,请帮我根据提供的代码判断是否符标准',
  },
])
print(response['message']['content'])

对不起我们的说明没有很好。还有问题可以多问,谢谢

<!-- gh-comment-id:1992708126 --> @mchiang0610 commented on GitHub (Mar 12, 2024): 要改prompt 大约可以这样 ``` import ollama response = ollama.chat(model='llama2', messages=[ { 'role': 'user', 'content': '你是一个CR专家,请帮我根据提供的代码判断是否符标准', }, ]) print(response['message']['content']) ``` 对不起我们的说明没有很好。还有问题可以多问,谢谢
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1228