MCPcopy Create free account
hub / github.com/grapeot/devin.cursorrules / main

Function main

tools/llm_api.py:244–271  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242 return None
243
244def main():
245 parser = argparse.ArgumentParser(description='Query an LLM with a prompt')
246 parser.add_argument('--prompt', type=str, help='The prompt to send to the LLM', required=True)
247 parser.add_argument('--provider', choices=['openai','anthropic','gemini','local','deepseek','azure','siliconflow'], default='openai', help='The API provider to use')
248 parser.add_argument('--model', type=str, help='The model to use (default depends on provider)')
249 parser.add_argument('--image', type=str, help='Path to an image file to attach to the prompt')
250 args = parser.parse_args()
251
252 if not args.model:
253 if args.provider == 'openai':
254 args.model = "gpt-4o"
255 elif args.provider == "deepseek":
256 args.model = "deepseek-chat"
257 elif args.provider == "siliconflow":
258 args.model = "deepseek-ai/DeepSeek-R1"
259 elif args.provider == 'anthropic':
260 args.model = "claude-3-7-sonnet-20250219"
261 elif args.provider == 'gemini':
262 args.model = "gemini-2.0-flash-exp"
263 elif args.provider == 'azure':
264 args.model = os.getenv('AZURE_OPENAI_MODEL_DEPLOYMENT', 'gpt-4o-ms') # Get from env with fallback
265
266 client = create_llm_client(args.provider)
267 response = query_llm(args.prompt, client, model=args.model, provider=args.provider, image_path=args.image)
268 if response:
269 print(response)
270 else:
271 print("Failed to get response from LLM")
272
273if __name__ == "__main__":
274 main()

Callers 1

llm_api.pyFile · 0.70

Calls 2

create_llm_clientFunction · 0.85
query_llmFunction · 0.85

Tested by

no test coverage detected