1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Fix prompt files (#56932)

Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com>
This commit is contained in:
Kate Catlin
2025-08-01 08:48:13 -07:00
committed by GitHub
parent 55f2034789
commit 97e4733746

View File

@@ -76,41 +76,34 @@ To call models programmatically, youll need:
1. Paste the following workflow into the file you just created. 1. Paste the following workflow into the file you just created.
```yaml ```yaml copy
name: GitHub Models Demo name: Use GitHub Models
on: [push] on: [push]
permissions: permissions:
contents: read
models: read models: read
jobs: jobs:
summarize-repo: call-model:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Call AI model
uses: {% data reusables.actions.action-checkout %} env:
GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
- name: Summarize the repository README
run: | run: |
SUMMARY_INPUT=$(head -c 4000 README.md) curl "https://models.github.ai/inference/chat/completions" \
PROMPT="Summarize this repository in one sentence. Here is the README:\n$SUMMARY_INPUT" -H "Content-Type: application/json" \
PAYLOAD=$(jq -n --arg prompt "$PROMPT" '{ -H "Authorization: Bearer $GITHUB_TOKEN" \
model: "openai/gpt-4.1", -d '{
messages: [ "messages": [
{role: "user", content: $prompt} {
] "role": "user",
}') "content": "Explain the concept of recursion."
RESPONSE=$(curl -sL \ }
-X POST \ ],
-H "Accept: application/vnd.github+json" \ "model": "openai/gpt-4o"
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ }'
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
https://models.github.ai/inference/chat/completions \
-d "$PAYLOAD")
echo "$RESPONSE" | jq -r '.choices[0].message.content'
``` ```
> [!NOTE] > [!NOTE]
@@ -128,13 +121,21 @@ This example shows how to send a prompt to a model and use the response in your
1. Paste the following example prompt into the file you just created. 1. Paste the following example prompt into the file you just created.
```yaml ```yaml copy
name: One-line summary name: Text Summarizer
description: Ask the model to summarize a paragraph in one sentence. description: Summarizes input text concisely
model: gpt-4o-mini
modelParameters:
temperature: 0.5
messages: messages:
- role: system
content: You are a text summarizer. Your only job is to summarize text given to you.
- role: user - role: user
content: 'Summarize the following text in one sentence: {{input}}' content: |
model: openai/gpt-4o Summarize the given text, beginning with "Summary -":
<text>
{% raw %}{{input}}{% endraw %}
</text>
``` ```
1. Commit and push the file to your repository. 1. Commit and push the file to your repository.
@@ -156,28 +157,37 @@ Evaluations help you measure how different models respond to the same inputs so
1. Update the file to match the following example. 1. Update the file to match the following example.
```yaml ```yaml copy
name: One-line summary name: Text Summarizer
description: Ask the model to summarize a paragraph in one sentence. description: Summarizes input text concisely
messages: model: gpt-4o-mini
- role: user modelParameters:
content: 'Summarize the following text in one sentence: {{input}}' temperature: 0.5
model: openai/gpt-4o messages:
testData: - role: system
- input: >- content: You are a text summarizer. Your only job is to summarize text given to you.
The museum opened a new dinosaur exhibit this weekend. Families from all - role: user
over the city came to see the life-sized fossils and interactive displays. content: |
expected: >- Summarize the given text, beginning with "Summary -":
The museum's new dinosaur exhibit attracted many families with its fossils <text>
and interactive displays. {% raw %}{{input}}{% endraw %}
- input: >- </text>
Lucy baked cookies for the school fundraiser. She spent the entire evening testData:
in the kitchen to make sure there were enough for everyone. - input: |
expected: Lucy baked cookies all evening to support the school fundraiser. The quick brown fox jumped over the lazy dog.
evaluators: The dog was too tired to react.
- name: Similarity expected: Summary - A fox jumped over a lazy, unresponsive dog.
uses: github/similarity - input: |
``` The museum opened a new dinosaur exhibit this weekend. Families from all
over the city came to see the life-sized fossils and interactive displays.
expected: Summary - The museum's new dinosaur exhibit attracted many families with its fossils and interactive displays.
evaluators:
- name: Output should start with 'Summary -'
string:
startsWith: 'Summary -'
- name: Similarity
uses: github/similarity
```
1. Commit and push the file to your repository. 1. Commit and push the file to your repository.