Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code snippets for text generation #181

Merged
merged 3 commits into from
Jul 12, 2024
Merged

Conversation

andrewheard
Copy link
Collaborator

  • Added text generation code snippets for use in documentation.
  • Added a CodeSnippetTests testTarget to the Swift package to ensure that the snippets build.
    • These "tests" are skipped (not run, only built) by default, including on CI, but can be run locally by setting the API_KEY environment variable in Xcode. They do not contain any assertions but output may be manually inspected.

samples/TextGeneration.swift Outdated Show resolved Hide resolved
samples/TextGeneration.swift Outdated Show resolved Hide resolved
@andrewheard
Copy link
Collaborator Author

@rachelsaunders These snippets are incomplete but would you mind doing an initial pass? In particular, the documentation around the model initialization since it's repeated in each snippet.

paulb777
paulb777 previously approved these changes Jul 10, 2024
@andrewheard andrewheard marked this pull request as ready for review July 11, 2024 23:56
@andrewheard andrewheard requested a review from paulb777 July 11, 2024 23:56
@github-actions github-actions bot added component:swift sdk Issue/PR related to Swift SDK status:awaiting review PR awaiting review from a maintainer labels Jul 11, 2024
@andrewheard andrewheard merged commit b72e9ba into main Jul 12, 2024
9 checks passed
@andrewheard andrewheard deleted the ah/snippets-text-gen branch July 12, 2024 00:03
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Jul 12, 2024
enefry added a commit to enefry/generative-ai-swift that referenced this pull request Oct 28, 2024
* 'main' of https://github.com/google/generative-ai-swift:
  Update version to 0.5.6 (google-gemini#206)
  Update `main` branch README for PaLM API decommissioning (google-gemini#205)
  Add a README for /samples (google-gemini#202)
  Add snippets for code execution (google-gemini#198)
  Add code execution support (google-gemini#196)
  Fix caution callout in README (google-gemini#197)
  Update Xcode version in CLI workflow (google-gemini#194)
  Fix region tag. (google-gemini#191)
  Add count tokens snippets for system instructions and tools (google-gemini#189)
  Add code snippets for controlled generation (google-gemini#188)
  Add a code snippet for function calling (google-gemini#187)
  Add documentation code snippets for model config (google-gemini#186)
  Add documentation code snippets for Chat (google-gemini#184)
  Add documentation code snippets for counting tokens (google-gemini#185)
  Add code snippets for text generation (google-gemini#181)
  Aligning the README with the Python's one (google-gemini#180)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:swift sdk Issue/PR related to Swift SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants