Load code examples from specified text files.
(example_files: List[str])
| 31 | return feature_descriptions |
| 32 | |
| 33 | def load_code_examples(example_files: List[str]) -> Dict[str, str]: |
| 34 | """ |
| 35 | Load code examples from specified text files. |
| 36 | """ |
| 37 | code_examples = {} |
| 38 | for file_path in example_files: |
| 39 | if not os.path.exists(file_path): |
| 40 | print(f"Warning: Code example file {file_path} does not exist.") |
| 41 | continue |
| 42 | try: |
| 43 | with open(file_path, 'r', encoding='utf-8') as f: |
| 44 | content = f.read() |
| 45 | code_examples[os.path.basename(file_path)] = content |
| 46 | except Exception as e: |
| 47 | print(f"Error loading code example file {file_path}: {str(e)}") |
| 48 | return code_examples |
| 49 | |
| 50 | def generate_enhanced_feature_descriptions(client: Groq, model_name: str, feature_descriptions: Dict[str, str], max_retries: int = 5) -> Dict[str, str]: |
| 51 | """ |