import logging
import os
from autogen import LLMConfig, UserProxyAgent
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
ossinsight_api_schema = {
"name": "ossinsight_data_api",
"parameters": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": (
"Enter your GitHub data question in the form of a clear and specific question to ensure the returned data is accurate and valuable. "
"For optimal results, specify the desired format for the data table in your request."
),
}
},
"required": ["question"],
},
"description": "This is an API endpoint allowing users (analysts) to input question about GitHub in text format to retrieve the related and structured data.",
}
def get_ossinsight(question):
"""[Mock] Retrieve the top 10 developers with the most followers on GitHub."""
report_components = [
f"Question: {question}",
"SQL: SELECT `login` AS `user_login`, `followers` AS `followers` FROM `github_users` ORDER BY `followers` DESC LIMIT 10",
"""Results:
{'followers': 166730, 'user_login': 'torvalds'}
{'followers': 86239, 'user_login': 'yyx990803'}
{'followers': 77611, 'user_login': 'gaearon'}
{'followers': 72668, 'user_login': 'ruanyf'}
{'followers': 65415, 'user_login': 'JakeWharton'}
{'followers': 60972, 'user_login': 'peng-zhihui'}
{'followers': 58172, 'user_login': 'bradtraversy'}
{'followers': 52143, 'user_login': 'gustavoguanabara'}
{'followers': 51542, 'user_login': 'sindresorhus'}
{'followers': 49621, 'user_login': 'tj'}""",
]
return "\n" + "\n\n".join(report_components) + "\n"