Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Support for Github Models (Github Marketplace) #410

Open
kevin-valerio opened this issue Sep 5, 2024 · 1 comment
Open

[Feature]: Support for Github Models (Github Marketplace) #410

kevin-valerio opened this issue Sep 5, 2024 · 1 comment

Comments

@kevin-valerio
Copy link

Description

Currently opencommit doesn't support Github Models API calls. It would be nice to have the support for Github models, as they're free to use (if you get your access granted) and gives you free API key to request differents models, GPT 4o included

Suggested Solution

The user could provide a GITHUB_TOKEN (free) instead of the OpenAI (not free) API key for the LLM requests.

Usage :

import os
from openai import OpenAI

token = os.environ["GITHUB_TOKEN"]
endpoint = "https://models.inference.ai.azure.com"
model_name = "gpt-4o-mini"

client = OpenAI(
    base_url=endpoint,
    api_key=token,
)

response = client.chat.completions.create(
    messages=[
        {
            "role": "system",
            "content": "You are in charge to create a commit name for all those differences:",
        },
        {
            "role": "user",
            "content": "What is the capital of France?",
        }
    ],
    model=model_name,
    temperature=1.,
    max_tokens=1000,
    top_p=1.
)

print(response.choices[0].message.content)

Alternatives

No response

Additional Context

No response

@di-sukharev
Copy link
Owner

@kevin-valerio nice idea! do you want to contribute a PR? if yes — this should not take longer than 40 minutes to implement, follow OpenAiEngine example or simply this file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants