You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
2 months ago
|
"""
|
||
|
Todo
|
||
|
|
||
|
- You send structured data to the swarm through the users form they make
|
||
|
- then connect rag for every agent using llama index to remember all the students data
|
||
|
- structured outputs
|
||
|
"""
|
||
|
|
||
|
import os
|
||
|
from dotenv import load_dotenv
|
||
|
from swarm_models import OpenAIChat, OpenAIFunctionCaller
|
||
|
from pydantic import BaseModel
|
||
|
from typing import List
|
||
|
|
||
|
|
||
|
class CollegeLog(BaseModel):
|
||
|
college_name: str
|
||
|
college_description: str
|
||
|
college_admission_requirements: str
|
||
|
|
||
|
|
||
|
class CollegesRecommendation(BaseModel):
|
||
|
colleges: List[CollegeLog]
|
||
|
reasoning: str
|
||
|
|
||
|
|
||
|
load_dotenv()
|
||
|
|
||
|
# Get the API key from environment variable
|
||
|
api_key = os.getenv("GROQ_API_KEY")
|
||
|
|
||
|
# Initialize the model
|
||
|
model = OpenAIChat(
|
||
|
openai_api_base="https://api.groq.com/openai/v1",
|
||
|
openai_api_key=api_key,
|
||
|
model_name="llama-3.1-70b-versatile",
|
||
|
temperature=0.1,
|
||
|
)
|
||
|
|
||
|
function_caller = OpenAIFunctionCaller(
|
||
|
system_prompt="""You are a college selection final decision maker. Your role is to:
|
||
|
- Balance all relevant factors and stakeholder input.
|
||
|
- Only return the output in the schema format.
|
||
|
""",
|
||
|
openai_api_key=os.getenv("OPENAI_API_KEY"),
|
||
|
base_model=CollegesRecommendation,
|
||
|
# parallel_tool_calls=True,
|
||
|
)
|
||
|
|
||
|
|
||
|
print(
|
||
|
function_caller.run(
|
||
|
"""
|
||
|
Student Profile: Kye Gomez
|
||
|
- GPA: 3.8
|
||
|
- SAT: 1450
|
||
|
- Interests: Computer Science, Robotics
|
||
|
- Location Preference: East Coast
|
||
|
- Extracurriculars: Robotics Club President, Math Team
|
||
|
- Budget: Need financial aid
|
||
|
- Preferred Environment: Medium-sized urban campus
|
||
|
"""
|
||
|
)
|
||
|
)
|