parent
bb235424d9
commit
9e2a5e5e8f
@ -0,0 +1 @@
|
|||||||
|
# api
|
@ -0,0 +1,28 @@
|
|||||||
|
import os
|
||||||
|
from openai import OpenAI
|
||||||
|
|
||||||
|
# To authenticate with the model you will need to generate a personal access token (PAT) in your GitHub settings.
|
||||||
|
# Create your PAT token by following instructions here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
||||||
|
client = OpenAI(
|
||||||
|
base_url="https://models.github.ai/inference",
|
||||||
|
api_key=os.environ["GITHUB_TOKEN"],
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.chat.completions.create(
|
||||||
|
messages=[
|
||||||
|
{
|
||||||
|
"role": "system",
|
||||||
|
"content": "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": "What is the capital of France?",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
model="openai/gpt-4o-mini",
|
||||||
|
temperature=1,
|
||||||
|
max_tokens=4096,
|
||||||
|
top_p=1
|
||||||
|
)
|
||||||
|
|
||||||
|
print(response.choices[0].message.content)
|
@ -0,0 +1 @@
|
|||||||
|
// js code
|
@ -0,0 +1,6 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Chat app</title>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
@ -0,0 +1,3 @@
|
|||||||
|
/* body {
|
||||||
|
|
||||||
|
} */
|
Loading…
Reference in new issue