Toggle Background Color
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | Contribution Agreement
3 | ======================
4 |
5 | This repository does not accept pull requests (PRs). All pull requests will be closed.
6 |
7 | However, if any contributions (through pull requests, issues, feedback or otherwise) are provided, as a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer). By submitting code (or otherwise providing feedback), you (and, if applicable, your employer) are licensing the submitted code (and/or feedback) to LinkedIn and the open source community subject to the BSD 2-Clause license.
8 |
--------------------------------------------------------------------------------
/filemanager.js:
--------------------------------------------------------------------------------
1 | const {GoogleAIFileManager} = require("@google/generative-ai/server")
2 | const mime = require("mime-types");
3 |
4 | const filePath = process.argv[2];
5 |
6 | (async ()=> {
7 |
8 | const mimeType = mime.lookup(filePath);
9 |
10 | const fileManager = new GoogleAIFileManager("AIzaSyAX1VhBZbCoFED5KoMbfHL5ec1xCbfsL_s")
11 |
12 | const uploadResult = await fileManager.uploadFile(filePath, {
13 | mimeType: mimeType,
14 | displayName: "A vase of tulips"
15 | })
16 |
17 | console.log(`
18 | File Uri: ${uploadResult.file.uri} \n
19 | Display Name: ${uploadResult.file.displayName} \n
20 | Mime Type: ${uploadResult.file.mimeType}
21 | `)
22 | })();
--------------------------------------------------------------------------------
/fileprompt.js:
--------------------------------------------------------------------------------
1 | const {GoogleGenerativeAI} = require("@google/generative-ai");
2 |
3 | const fileURL = process.argv[2];
4 | const mimeType = process.argv[4];
5 |
6 | (async () => {
7 |
8 | const generativeAI = new GoogleGenerativeAI("AIzaSyAX1VhBZbCoFED5KoMbfHL5ec1xCbfsL_s");
9 |
10 | const geminiModel = generativeAI.getGenerativeModel({
11 | model: "gemini-1.5-flash"
12 | })
13 |
14 | const request = await geminiModel.generateContent([
15 | {
16 | fileData: {
17 | mimeType: mimeType,
18 | fileUri: fileURL
19 | }
20 | },
21 | {
22 | "text": "Analyze this file"
23 | }
24 | ])
25 |
26 | const response = await request.response;
27 |
28 | const result = response.text();
29 |
30 | console.log(result);
31 | })();
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | ## Issue Overview
9 |
10 |
11 | ## Describe your environment
12 |
13 |
14 | ## Steps to Reproduce
15 |
16 | 1.
17 | 2.
18 | 3.
19 | 4.
20 |
21 | ## Expected Behavior
22 |
23 |
24 | ## Current Behavior
25 |
26 |
27 | ## Possible Solution
28 |
29 |
30 | ## Screenshots / Video
31 |
32 |
33 | ## Related Issues
34 |
35 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright 2024 LinkedIn Corporation
2 | All Rights Reserved.
3 |
4 | Licensed under the LinkedIn Learning Exercise File License (the "License").
5 | See LICENSE in the project root for license information.
6 |
7 | ATTRIBUTIONS:
8 |
9 | Certainly! Here’s the list with the URLs in text format:
10 |
11 | --------------------
12 | **mime-db**
13 | https://github.com/jshttp/mime-db
14 | License: MIT
15 | https://opensource.org/licenses/MIT
16 | --------------------
17 | **mime-types**
18 | https://github.com/jshttp/mime-types
19 | License: MIT
20 | https://opensource.org/licenses/MIT
21 | --------------------
22 | **@google/generative-ai**
23 | https://github.com/google/generative-ai
24 | License: Apache-2.0
25 | http://www.apache.org/licenses/LICENSE-2.0
26 | --------------------
27 |
28 |
29 | Let me know if you need any further adjustments!
30 |
31 |
32 | Please note, this project may automatically load third party code from external
33 | repositories (for example, NPM modules, Composer packages, or other dependencies).
34 | If so, such third party code may be subject to other license terms than as set
35 | forth above. In addition, such third party code may also depend on and load
36 | multiple tiers of dependencies. Please review the applicable licenses of the
37 | additional dependencies.
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Advanced Gemini API for Integration
2 | This is the repository for the LinkedIn Learning course `Advanced Gemini API for Integration`. The full course is available from [LinkedIn Learning][lil-course-url].
3 |
4 | ![lil-thumbnail-url]
5 |
6 | ## Course Description
7 |
8 | The Gemini API allows you to integrate your apps with one of Google’s largest and most powerful AI models. In this course, instructor Fikayo Adepoju provides an overview of how to successfully configure and utilize the Gemini API to get the results you want every time with ease. Explore the basics of configuring the API for model generation, prompting with media and files, managing safety, leveraging advanced features, and using Gemini 1.5 Pro to generate code. This course is ideal for software engineers who already have a basic understanding of the Gemini API but want to learn more about how to use it more effectively.
9 |
10 | ## Instructor
11 |
12 | Fikayo Adepoju
13 |
14 | Technical Writer | Software Developer
15 |
16 |
17 |
18 | Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/fikayo-adepoju?u=104).
19 |
20 |
21 |
22 | [0]: # (Replace these placeholder URLs with actual course URLs)
23 |
24 | [lil-course-url]: https://www.linkedin.com/learning/advanced-gemini-api-for-integration
25 | [lil-thumbnail-url]: https://media.licdn.com/dms/image/v2/D4D0DAQGk30IWE_9I1w/learning-public-crop_675_1200/learning-public-crop_675_1200/0/1729870978392?e=2147483647&v=beta&t=d4OEeA12maov_bLyPD4GR2EqJaQN0CZXo2EB0TytLeE
26 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | LinkedIn Learning Exercise Files License Agreement
2 | ==================================================
3 |
4 | This License Agreement (the "Agreement") is a binding legal agreement
5 | between you (as an individual or entity, as applicable) and LinkedIn
6 | Corporation (“LinkedIn”). By downloading or using the LinkedIn Learning
7 | exercise files in this repository (“Licensed Materials”), you agree to
8 | be bound by the terms of this Agreement. If you do not agree to these
9 | terms, do not download or use the Licensed Materials.
10 |
11 | 1. License.
12 | - a. Subject to the terms of this Agreement, LinkedIn hereby grants LinkedIn
13 | members during their LinkedIn Learning subscription a non-exclusive,
14 | non-transferable copyright license, for internal use only, to 1) make a
15 | reasonable number of copies of the Licensed Materials, and 2) make
16 | derivative works of the Licensed Materials for the sole purpose of
17 | practicing skills taught in LinkedIn Learning courses.
18 | - b. Distribution. Unless otherwise noted in the Licensed Materials, subject
19 | to the terms of this Agreement, LinkedIn hereby grants LinkedIn members
20 | with a LinkedIn Learning subscription a non-exclusive, non-transferable
21 | copyright license to distribute the Licensed Materials, except the
22 | Licensed Materials may not be included in any product or service (or
23 | otherwise used) to instruct or educate others.
24 |
25 | 2. Restrictions and Intellectual Property.
26 | - a. You may not to use, modify, copy, make derivative works of, publish,
27 | distribute, rent, lease, sell, sublicense, assign or otherwise transfer the
28 | Licensed Materials, except as expressly set forth above in Section 1.
29 | - b. Linkedin (and its licensors) retains its intellectual property rights
30 | in the Licensed Materials. Except as expressly set forth in Section 1,
31 | LinkedIn grants no licenses.
32 | - c. You indemnify LinkedIn and its licensors and affiliates for i) any
33 | alleged infringement or misappropriation of any intellectual property rights
34 | of any third party based on modifications you make to the Licensed Materials,
35 | ii) any claims arising from your use or distribution of all or part of the
36 | Licensed Materials and iii) a breach of this Agreement. You will defend, hold
37 | harmless, and indemnify LinkedIn and its affiliates (and our and their
38 | respective employees, shareholders, and directors) from any claim or action
39 | brought by a third party, including all damages, liabilities, costs and
40 | expenses, including reasonable attorneys’ fees, to the extent resulting from,
41 | alleged to have resulted from, or in connection with: (a) your breach of your
42 | obligations herein; or (b) your use or distribution of any Licensed Materials.
43 |
44 | 3. Open source. This code may include open source software, which may be
45 | subject to other license terms as provided in the files.
46 |
47 | 4. Warranty Disclaimer. LINKEDIN PROVIDES THE LICENSED MATERIALS ON AN “AS IS”
48 | AND “AS AVAILABLE” BASIS. LINKEDIN MAKES NO REPRESENTATION OR WARRANTY,
49 | WHETHER EXPRESS OR IMPLIED, ABOUT THE LICENSED MATERIALS, INCLUDING ANY
50 | REPRESENTATION THAT THE LICENSED MATERIALS WILL BE FREE OF ERRORS, BUGS OR
51 | INTERRUPTIONS, OR THAT THE LICENSED MATERIALS ARE ACCURATE, COMPLETE OR
52 | OTHERWISE VALID. TO THE FULLEST EXTENT PERMITTED BY LAW, LINKEDIN AND ITS
53 | AFFILIATES DISCLAIM ANY IMPLIED OR STATUTORY WARRANTY OR CONDITION, INCLUDING
54 | ANY IMPLIED WARRANTY OR CONDITION OF MERCHANTABILITY OR FITNESS FOR A
55 | PARTICULAR PURPOSE, AVAILABILITY, SECURITY, TITLE AND/OR NON-INFRINGEMENT.
56 | YOUR USE OF THE LICENSED MATERIALS IS AT YOUR OWN DISCRETION AND RISK, AND
57 | YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE THAT RESULTS FROM USE OF THE
58 | LICENSED MATERIALS TO YOUR COMPUTER SYSTEM OR LOSS OF DATA. NO ADVICE OR
59 | INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM US OR THROUGH OR
60 | FROM THE LICENSED MATERIALS WILL CREATE ANY WARRANTY OR CONDITION NOT
61 | EXPRESSLY STATED IN THESE TERMS.
62 |
63 | 5. Limitation of Liability. LINKEDIN SHALL NOT BE LIABLE FOR ANY INDIRECT,
64 | INCIDENTAL, SPECIAL, PUNITIVE, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING
65 | BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER
66 | INTANGIBLE LOSSES . IN NO EVENT WILL LINKEDIN'S AGGREGATE LIABILITY TO YOU
67 | EXCEED $100. THIS LIMITATION OF LIABILITY SHALL:
68 | - i. APPLY REGARDLESS OF WHETHER (A) YOU BASE YOUR CLAIM ON CONTRACT, TORT,
69 | STATUTE, OR ANY OTHER LEGAL THEORY, (B) WE KNEW OR SHOULD HAVE KNOWN ABOUT
70 | THE POSSIBILITY OF SUCH DAMAGES, OR (C) THE LIMITED REMEDIES PROVIDED IN THIS
71 | SECTION FAIL OF THEIR ESSENTIAL PURPOSE; AND
72 | - ii. NOT APPLY TO ANY DAMAGE THAT LINKEDIN MAY CAUSE YOU INTENTIONALLY OR
73 | KNOWINGLY IN VIOLATION OF THESE TERMS OR APPLICABLE LAW, OR AS OTHERWISE
74 | MANDATED BY APPLICABLE LAW THAT CANNOT BE DISCLAIMED IN THESE TERMS.
75 |
76 | 6. Termination. This Agreement automatically terminates upon your breach of
77 | this Agreement or termination of your LinkedIn Learning subscription. On
78 | termination, all licenses granted under this Agreement will terminate
79 | immediately and you will delete the Licensed Materials. Sections 2-7 of this
80 | Agreement survive any termination of this Agreement. LinkedIn may discontinue
81 | the availability of some or all of the Licensed Materials at any time for any
82 | reason.
83 |
84 | 7. Miscellaneous. This Agreement will be governed by and construed in
85 | accordance with the laws of the State of California without regard to conflict
86 | of laws principles. The exclusive forum for any disputes arising out of or
87 | relating to this Agreement shall be an appropriate federal or state court
88 | sitting in the County of Santa Clara, State of California. If LinkedIn does
89 | not act to enforce a breach of this Agreement, that does not mean that
90 | LinkedIn has waived its right to enforce this Agreement. The Agreement does
91 | not create a partnership, agency relationship, or joint venture between the
92 | parties. Neither party has the power or authority to bind the other or to
93 | create any obligation or responsibility on behalf of the other. You may not,
94 | without LinkedIn’s prior written consent, assign or delegate any rights or
95 | obligations under these terms, including in connection with a change of
96 | control. Any purported assignment and delegation shall be ineffective. The
97 | Agreement shall bind and inure to the benefit of the parties, their respective
98 | successors and permitted assigns. If any provision of the Agreement is
99 | unenforceable, that provision will be modified to render it enforceable to the
100 | extent possible to give effect to the parties’ intentions and the remaining
101 | provisions will not be affected. This Agreement is the only agreement between
102 | you and LinkedIn regarding the Licensed Materials, and supersedes all prior
103 | agreements relating to the Licensed Materials.
104 |
105 | Last Updated: March 2019
106 |
--------------------------------------------------------------------------------