Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

provider.py 1.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  1. import asyncio
  2. from typing import Any, Dict
  3. from agent import run_recruitment_agent
  4. def call_api(
  5. prompt: str, options: Dict[str, Any], context: Dict[str, Any]
  6. ) -> Dict[str, Any]:
  7. """
  8. Calls the CrewAI recruitment agent with the provided prompt.
  9. Wraps the async function in a synchronous call for Promptfoo.
  10. """
  11. try:
  12. # ✅ Run the async recruitment agent synchronously
  13. result = asyncio.run(run_recruitment_agent(prompt))
  14. return {"output": result}
  15. except Exception as e:
  16. # 🔥 Catch and return any error as part of the output
  17. return {"output": {"candidates": [], "summary": f"Error occurred: {str(e)}"}}
  18. if __name__ == "__main__":
  19. # 🧪 Simple test block to check provider behavior standalone
  20. print("✅ Testing CrewAI provider...")
  21. # 🔧 Example test prompt
  22. test_prompt = "We need a Ruby on Rails and React engineer."
  23. # âš¡ Call the API function with test inputs
  24. result = call_api(test_prompt, {}, {})
  25. # 📦 Print the result to console
  26. print("Provider result:", result)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...