@@ -38,7 +38,15 @@ def delete_all_resumecraftr_agents():
3838 console .print (f"[bold red]Error deleting agents: { e } [/bold red]" )
3939
4040def get_vector_store_id_by_name (agent_name : str ) -> str :
41- """Retrieve the vector store ID by the agent's name."""
41+ """
42+ Retrieve the vector store ID by the agent's name.
43+
44+ Args:
45+ agent_name (str): The name of the agent.
46+
47+ Returns:
48+ str: The ID of the vector store.
49+ """
4250 vector_stores = client .beta .vector_stores .list ()
4351 expected_name = f"{ agent_name } Docs"
4452
@@ -51,20 +59,36 @@ def get_vector_store_id_by_name(agent_name: str) -> str:
5159 )
5260 return None
5361
54-
5562def load_supported_files (directory : str ) -> list :
56- """Load all supported document files from the given directory and subdirectories."""
63+ """
64+ Load all supported document files from the given directory and subdirectories.
65+
66+ Args:
67+ directory (str): The directory to search for files.
68+
69+ Returns:
70+ list: A list of file paths.
71+ """
5772 console .print (f"[bold blue]Loading documents from '{ directory } '...[/bold blue]" )
5873 files = []
5974 for ext in SUPPORTED_EXTENSIONS :
6075 files .extend (glob .glob (f"{ directory } /**/*{ ext } " , recursive = True ))
6176 return files
6277
63-
6478def upload_files_to_vector_store (
6579 vector_store_id : str , progress : Progress = None , task = None
6680):
67- """Upload all supported files to the specified vector store."""
81+ """
82+ Upload all supported files to the specified vector store.
83+
84+ Args:
85+ vector_store_id (str): The ID of the vector store.
86+ progress (Progress, optional): The progress object for displaying progress.
87+ task (optional): The task object for updating progress.
88+
89+ Returns:
90+ None
91+ """
6892 files = load_supported_files (CV_WORKSPACE )
6993
7094 if not files :
@@ -88,9 +112,16 @@ def upload_files_to_vector_store(
88112 f"[bold green]Files uploaded successfully to vector store '{ vector_store_id } '.[/bold green]"
89113 )
90114
91-
92115def create_or_get_agent (name = None ):
93- """Create or retrieve an assistant for document processing."""
116+ """
117+ Create or retrieve an assistant for document processing.
118+
119+ Args:
120+ name (str, optional): The name of the agent. Defaults to None.
121+
122+ Returns:
123+ assistant: The created or retrieved assistant.
124+ """
94125 if not os .path .exists (CONFIG_FILE ):
95126 console .print (
96127 "[bold red]Configuration file not found. Run 'resumecraftr init' first.[/bold red]"
@@ -135,11 +166,17 @@ def create_or_get_agent(name=None):
135166 )
136167 return assistant
137168
138-
139169def execute_prompt (prompt : str , name = None ) -> str :
140170 """
141171 Execute a given prompt using the AI agent, ensuring the vector database is refreshed.
142172 Provides real-time feedback to the user using Rich.
173+
174+ Args:
175+ prompt (str): The prompt to send to the AI agent.
176+ name (str, optional): The name of the agent. Defaults to None.
177+
178+ Returns:
179+ str: The response from the AI agent.
143180 """
144181 assistant = create_or_get_agent (name )
145182 thread = client .beta .threads .create ()
0 commit comments