Add file analysis
This commit is contained in:
		
							parent
							
								
									349a2bbbb6
								
							
						
					
					
						commit
						ca03f5c5a4
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		|  | @ -5,7 +5,7 @@ class Tests { | ||||||
|     #toolkit; |     #toolkit; | ||||||
| 
 | 
 | ||||||
|     constructor () { |     constructor () { | ||||||
|         this.#key = process.env.GoogleGenAIKey |         this.#key = process.env.GoogleGenAIKey; | ||||||
|         this.#toolkit = new GoogleGenAI({ apiKey: this.#key }); |         this.#toolkit = new GoogleGenAI({ apiKey: this.#key }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -15,6 +15,19 @@ class Tests { | ||||||
|           "contents": contents |           "contents": contents | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|  |         return response; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     async analyzefile (model, message, files) { | ||||||
|  |         const contents = [ | ||||||
|  |             { text: message }, ...files | ||||||
|  |         ]; | ||||||
|  | 
 | ||||||
|  |         const response = await this.#toolkit.models.generateContent({ | ||||||
|  |             model: model, | ||||||
|  |             contents: contents | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|         return response; |         return response; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue