You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,72 +11,167 @@ The GitHub Models provider is available in the `@github/models` NPM package. You
11
11
npm i @github/models
12
12
```
13
13
14
-
## Provider Instance
14
+
## Quick Start
15
15
16
16
To get started, you'll need a [GitHub PAT (personal access token)](https://github.com/settings/tokens).
17
17
18
-
> [!TIP]
19
-
> If you want to use GitHub Models beyond the [free usage](https://gh.io/models-rate-limits) included in your account, you can choose to opt in to paid usage. For more information, visit the [pricing page](https://gh.io/github-models-pricing).
20
-
21
18
The GitHub Models provider instance is used to create model instances that call the [GitHub Models Inference API](https://docs.github.com/en/rest/models/inference?apiVersion=2022-11-28#run-an-inference-request).
22
19
Please find all the available models on the [models catalog](https://github.com/marketplace?type=models).
prompt: 'I want 100 words on how to inflate a balloon.',
27
+
prompt: 'Write a haiku about programming.',
37
28
})
29
+
30
+
console.log(result.text)
38
31
```
39
32
33
+
> [!TIP]
34
+
> GitHub Models includes [free usage](https://gh.io/models-rate-limits) for all accounts. For higher usage limits, you can opt into [paid usage](https://gh.io/github-models-pricing).
35
+
40
36
If you need a customized setup, you can import `createGithubModels` from `@github/models` and create a provider instance with your settings:
41
37
42
38
```ts
43
39
import {createGithubModels} from'@github/models'
44
40
45
41
const githubModels =createGithubModels({
46
-
org: 'my-org',
42
+
org: 'my-organization',
43
+
apiKey: process.env.GITHUB_TOKEN,
44
+
baseURL: 'https://models.github.ai/inference',
47
45
})
48
46
```
49
47
50
-
You can use the following optional settings to customize the GitHub Models provider instance:
48
+
### Configuration Options
51
49
52
-
-**org**_string_
50
+
-**apiKey**_string_
51
+
Your GitHub [Personal Access Token](https://github.com/settings/tokens) or [Fine-Grained Token](https://github.com/settings/personal-access-tokens) with `read:models` scope.
52
+
Defaults to the `GITHUB_TOKEN` environment variable.
53
53
54
-
Set the organization that should be used to attribute inference.
54
+
-**org**_string_
55
+
Organization to attribute API usage to (optional).
55
56
56
57
-**baseURL**_string_
58
+
Custom API endpoint URL.
59
+
Defaults to `https://models.github.ai/inference`.
57
60
58
-
Use a different URL prefix for API calls. The default prefix is `https://models.github.ai/inference`.
You can use it as a middleware to intercept requests,
68
+
or to provide a custom fetch implementation for e.g. testing.
61
69
62
-
API key that is being sent using the `Authorization` header. Either a
63
-
GitHub PAT [_(Personal Access Token)_](https://github.com/settings/tokens), or FGT [_(Fine-Grained Token)_](https://github.com/settings/personal-access-tokens) with the `read:models` scope.
64
-
It defaults to the `GITHUB_TOKEN` environment variable.
70
+
## Prompt Management
65
71
66
-
-**headers**_Record<string,string>_
72
+
The `@github/models/prompt` sub-module provides a powerful way to integrate with AI SDK methods like `generateText` and `generateObject` using your `prompt.yml` files.
73
+
Prompt YAML files are designed to create reusable artifacts that integrate with GitHub's suite of AI tools. Check out the [Models tab](https://github.com/github/models-ai-sdk/models).
The GitHub Models provider uses the [GitHub Models Inference API](https://docs.github.com/en/rest/models/inference?apiVersion=2022-11-28#run-an-inference-request).
76
171
77
172
## License
78
173
79
-
Distributed under the MIT license. See [LICENSE](./license.txt) for details.
174
+
Distributed under the MIT License. See [LICENSE](./license.txt) for more information.
0 commit comments