Архив.ДуДу2
Github Models New
# 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


import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import SystemMessage, UserMessage
from azure.core.credentials import AzureKeyCredential
endpoint = "https://models.github.ai/inference"
model = "openai/gpt-4.1"
token = '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'
client = ChatCompletionsClient(
    endpoint=endpoint,
    credential=AzureKeyCredential(token),
)
response = client.complete(
    messages=[
        SystemMessage("You are a helpful assistant."),
        UserMessage(input('Ваш запрос: ')),
    ],
    model=model
)
print(response.choices[0].message.content)

Комментарии:

Пока нет комментариев.