|
1 |
| -# Google AI Swift SDK for PaLM |
2 |
| - |
3 |
| -[](https://swiftpackageindex.com/google/generative-ai-swift) |
4 |
| -[](https://swiftpackageindex.com/google/generative-ai-swift) |
5 |
| - |
6 |
| -> [!IMPORTANT] |
7 |
| -> This version (`0.3.0`) of the SDK is intended for being used with the PaLM LLM. If you would like to use the Gemini multimodal model, please migrate to the `main` branch to use the new version of the SDK. |
8 |
| -
|
9 |
| -The Google Generative AI SDK for Swift allows developers to use state-of-the-art Large Language Models (LLMs) to build language applications. |
10 |
| - |
11 |
| -Once you've added the Swift package to your Swift application, you can call the API as follows: |
12 |
| - |
13 |
| -```swift |
14 |
| -import GoogleGenerativeAI |
15 |
| - |
16 |
| -let palmClient = GenerativeLanguage(apiKey: "YOUR API KEY") |
17 |
| -response = try await palmClient.chat(message: "Hello") |
18 |
| -``` |
19 |
| - |
20 |
| - |
21 |
| -## Getting Started |
22 |
| - |
23 |
| -This repository contains a few sample apps. To try them out, follow these steps: |
24 |
| - |
25 |
| -1. Check out this repository. |
26 |
| - ```swift |
27 |
| - git clone https://github.com/google/generative-ai-swift |
28 |
| - ``` |
29 |
| -1. Follow the instructions on the [setup page](https://developers.generativeai.google/tutorials/setup) to obtain an API key. |
30 |
| -1. Open and build one of the examples in the `Examples` folder. |
31 |
| -1. Paste the API key into the `API_KEY` property in the `PaLM-Info.plist` file. |
32 |
| -1. Run the app. |
33 |
| - |
34 |
| - |
35 |
| -## Using the PaLM SDK in your own app |
36 |
| - |
37 |
| -To use the Swift SDK for the PaLM API in your own apps, follow these steps: |
38 |
| - |
39 |
| -1. Create a new Swift app (or use your existing app). |
40 |
| -1. Right-click on your project in the project navigator. |
41 |
| -1. Select _Add Packages_ from the context menu. |
42 |
| -1. In the _Add Packages_ dialog, paste the package URL into the search bar: https://github.com/google/generative-ai-swift |
43 |
| -1. Click on _Add Package_. Xcode will now add the _GoogleGenerativeAI_ to your project. |
44 |
| - |
45 |
| -### Initializing the API client |
46 |
| - |
47 |
| -Before you can make any API calls, you need to import and initialize the API |
48 |
| -client. |
49 |
| - |
50 |
| -1. Import the `GoogleGenerativeAI` module: |
51 |
| - ```swift |
52 |
| - import GoogleGenerativeAI |
53 |
| - ``` |
54 |
| -1. Initialize the API client: |
55 |
| - ```swift |
56 |
| - let palmClient = GenerativeLanguage(apiKey: "YOUR API KEY") |
57 |
| - ``` |
58 |
| - |
59 |
| -### Calling the API |
60 |
| - |
61 |
| -Now you're ready to call the PaLM API's methods. |
62 |
| - |
63 |
| -> **Note**: All API methods are asynchronous, so you need to call them using Swift's |
64 |
| -async/await. |
65 |
| - |
66 |
| -For example, here is how you can call the `generateText` method to summarize a Wikipedia article: |
67 |
| - |
68 |
| -```swift |
69 |
| -let prompt = "Summarise the following text: https://wikipedia.org/..." |
70 |
| - |
71 |
| -let response = try await palmClient.generateText(with: prompt) |
72 |
| - |
73 |
| -if let candidate = response?.candidates?.first, let text = candidate.output { |
74 |
| - print(text) |
75 |
| -} |
76 |
| -``` |
77 |
| - |
78 |
| - |
79 |
| -## Documentation |
80 |
| - |
81 |
| -You can find the documentation for the PaLM API at https://developers.generativeai.google.com/guide |
82 |
| - |
83 |
| - |
84 |
| -## Contributing |
85 |
| - |
86 |
| -See [Contributing](docs/CONTRIBUTING.md) for more information on contributing to the Generative AI SDK for Swift. |
87 |
| - |
| 1 | +# Google AI Swift SDK for PaLM (Decommissioned) |
| 2 | + |
| 3 | +> [!CAUTION] |
| 4 | +> This version (`0.3.0`) of the SDK was intended for use with the PaLM API, |
| 5 | +> which is now [decommissioned](https://ai.google.dev/palm_docs/deprecation) as |
| 6 | +> August 20, 2024. This means that users cannot use a PaLM model in a prompt, |
| 7 | +> tune a new PaLM model, or run inference on PaLM-tuned models. |
| 8 | +
|
| 9 | +To interact with models using Google AI services and tooling, use the Gemini |
| 10 | +API, which is now available in a stable version. For more information on |
| 11 | +migrating from PaLM to Gemini, see the |
| 12 | +[migration guide](https://ai.google.dev/docs/migration_guide) and the |
| 13 | +[`main`](https://github.com/google-gemini/generative-ai-swift/tree/main) branch |
| 14 | +of this repo to use the new version of the SDK. |
88 | 15 |
|
89 | 16 | ## License
|
90 | 17 |
|
|
0 commit comments