PraneshJs's picture
Update azure_ai.py
eeb5428 verified
import os
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.getenv("KEY")
)
def enhance_with_ai(repo_info):
file_summaries = "\n".join([
f"### {name}\n```{content[:300]}```"
for name, content in list(repo_info['files'].items())[:10]
])
prompt = f"""
Create a professional README.md for a GitHub project named "{repo_info['name']}".
Description: {repo_info['description']}
Topics: {', '.join(repo_info['topics'])}
The project includes the following files:
{file_summaries}
README must include: Introduction, Features, Installation, Usage, Contributing, and License.
ADD TITLE AND BADGES IF POSSIBLE.
USE RELAVENT EMOJIES.
Give only the READEME CONTENT as OUTPUT and GET USERNAME from the Clone link pasted by The USER.
Make SURE the connent is in .md or markdown format and NOT as .txt or simple text.
MAKE SURE the README GETS MORE STARS TO THE PROJECT GIVE LIKE THAT
"""
response = client.chat.completions.create(
model="google/gemma-3-27b-it:free",
messages=[
{"role": "system", "content": "You are a helpful assistant that creates GitHub READMEs. You must follow the provided structure and include all necessary sections. Use necessary emojies and markdown formatting."},
{"role": "user", "content": prompt}
]
)
return response.choices[0].message.content