Архив.ДуДу2
GitHub Models
Github API
https://github.com/settings/tokens
Base URL:  https://models.inference.ai.azure.com
пример кода на Python:


> pip install azure-ai-inference

import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import SystemMessage
from azure.ai.inference.models import UserMessage
from azure.core.credentials import AzureKeyCredential

client = ChatCompletionsClient(
    endpoint="https://models.github.ai/inference",
    credential=AzureKeyCredential(os.environ["GITHUB_TOKEN"]),
)
response = client.complete(
    messages=[
        SystemMessage(""""""),
        UserMessage("Can you explain the basics of machine learning?"),
    ],
    model="openai/gpt-4o",
    temperature=1,
    max_tokens=4096,
    top_p=1
)
print(response.choices[0].message.content)

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

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