@@ -28,7 +28,7 @@ <h1 class="title">Module <code>praisonai.auto</code></h1>
2828</ summary >
2929< pre > < code class ="python "> from openai import OpenAI
3030from pydantic import BaseModel
31- from typing import Dict, List
31+ from typing import Dict, List, Optional
3232import instructor
3333import os
3434import json
@@ -51,27 +51,29 @@ <h1 class="title">Module <code>praisonai.auto</code></h1>
5151 roles: Dict[str, RoleDetails]
5252
5353class AutoGenerator:
54- def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai"):
54+ def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai", config_list: Optional[List[Dict]] = None ):
5555 """
5656 Initialize the AutoGenerator class with the specified topic, agent file, and framework.
57- note : autogen framework is different from this AutoGenerator class.
57+ Note : autogen framework is different from this AutoGenerator class.
5858
5959 Args:
6060 topic (str, optional): The topic for the generated team structure. Defaults to "Movie Story writing about AI".
6161 agent_file (str, optional): The name of the YAML file to save the generated team structure. Defaults to "test.yaml".
6262 framework (str, optional): The framework for the generated team structure. Defaults to "crewai".
63-
63+ config_list (Optional[List[Dict]], optional): A list containing the configuration details for the OpenAI API.
64+ If None, it defaults to using environment variables or hardcoded values.
6465 Attributes:
6566 config_list (list): A list containing the configuration details for the OpenAI API.
6667 topic (str): The specified topic for the generated team structure.
6768 agent_file (str): The specified name of the YAML file to save the generated team structure.
6869 framework (str): The specified framework for the generated team structure.
6970 client (instructor.Client): An instance of the instructor.Client class initialized with the specified OpenAI API configuration.
7071 """
71- self.config_list = [
72+ self.config_list = config_list or [
7273 {
7374 'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
7475 'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
76+ 'api_key': os.environ.get("OPENAI_API_KEY")
7577 }
7678 ]
7779 self.topic = topic
@@ -225,11 +227,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>
225227< dl >
226228< dt id ="praisonai.auto.AutoGenerator "> < code class ="flex name class ">
227229< span > class < span class ="ident "> AutoGenerator</ span > </ span >
228- < span > (</ span > < span > topic='Movie Story writing about AI', agent_file='test.yaml', framework='crewai')</ span >
230+ < span > (</ span > < span > topic='Movie Story writing about AI', agent_file='test.yaml', framework='crewai', config_list: Optional[List[Dict]] = None )</ span >
229231</ code > </ dt >
230232< dd >
231233< div class ="desc "> < p > Initialize the AutoGenerator class with the specified topic, agent file, and framework.
232- note : autogen framework is different from this AutoGenerator class.</ p >
234+ Note : autogen framework is different from this AutoGenerator class.</ p >
233235< h2 id ="args "> Args</ h2 >
234236< dl >
235237< dt > < strong > < code > topic</ code > </ strong > : < code > str</ code > , optional</ dt >
@@ -238,6 +240,9 @@ <h2 id="args">Args</h2>
238240< dd > The name of the YAML file to save the generated team structure. Defaults to "test.yaml".</ dd >
239241< dt > < strong > < code > framework</ code > </ strong > : < code > str</ code > , optional</ dt >
240242< dd > The framework for the generated team structure. Defaults to "crewai".</ dd >
243+ < dt > < strong > < code > config_list</ code > </ strong > : < code > Optional[List[Dict]]</ code > , optional</ dt >
244+ < dd > A list containing the configuration details for the OpenAI API.
245+ If None, it defaults to using environment variables or hardcoded values.</ dd >
241246</ dl >
242247< h2 id ="attributes "> Attributes</ h2 >
243248< dl >
@@ -257,27 +262,29 @@ <h2 id="attributes">Attributes</h2>
257262< span > Expand source code</ span >
258263</ summary >
259264< pre > < code class ="python "> class AutoGenerator:
260- def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai"):
265+ def __init__(self, topic="Movie Story writing about AI", agent_file="test.yaml", framework="crewai", config_list: Optional[List[Dict]] = None ):
261266 """
262267 Initialize the AutoGenerator class with the specified topic, agent file, and framework.
263- note : autogen framework is different from this AutoGenerator class.
268+ Note : autogen framework is different from this AutoGenerator class.
264269
265270 Args:
266271 topic (str, optional): The topic for the generated team structure. Defaults to "Movie Story writing about AI".
267272 agent_file (str, optional): The name of the YAML file to save the generated team structure. Defaults to "test.yaml".
268273 framework (str, optional): The framework for the generated team structure. Defaults to "crewai".
269-
274+ config_list (Optional[List[Dict]], optional): A list containing the configuration details for the OpenAI API.
275+ If None, it defaults to using environment variables or hardcoded values.
270276 Attributes:
271277 config_list (list): A list containing the configuration details for the OpenAI API.
272278 topic (str): The specified topic for the generated team structure.
273279 agent_file (str): The specified name of the YAML file to save the generated team structure.
274280 framework (str): The specified framework for the generated team structure.
275281 client (instructor.Client): An instance of the instructor.Client class initialized with the specified OpenAI API configuration.
276282 """
277- self.config_list = [
283+ self.config_list = config_list or [
278284 {
279285 'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
280286 'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
287+ 'api_key': os.environ.get("OPENAI_API_KEY")
281288 }
282289 ]
283290 self.topic = topic
0 commit comments