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

develop #1

Merged
merged 249 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
249 commits
Select commit Hold shift + click to select a range
e19b8b0
Add dataclass prettyprinting. (#73)
MarkDaoust Oct 10, 2023
46db06f
Add metadata handling. (#74)
MarkDaoust Oct 10, 2023
125c436
Add count_text_tokens, and expose operations. (#76)
MarkDaoust Oct 11, 2023
923d372
Update gspread_client.py (#82)
sbagri Oct 11, 2023
2eb5e82
Update dataset construction code to handle more input types. (#79)
MarkDaoust Oct 18, 2023
2e9f23e
Restore ModelNameOptions for backwards compatibility. (#87)
MarkDaoust Oct 18, 2023
14915d9
Support specific tabs when loading Google Sheets (#88)
markmcd Oct 18, 2023
0d8d339
Handle max batch size for embeddings. (#83)
MarkDaoust Oct 19, 2023
db0fe2d
Simplify list-models iteration - the GAPIC lib handles this. (#86)
MarkDaoust Oct 19, 2023
c4199bb
Support python 3.12 (#89)
MarkDaoust Oct 20, 2023
f619444
Revert "Support python 3.12 (#89)" (#91)
MarkDaoust Oct 23, 2023
e5f4463
Release 0.2.2 (#90)
MarkDaoust Oct 23, 2023
152d2cf
Fix source URLs for `glm.*` members. (#94)
markmcd Oct 31, 2023
e108d23
Allow `refresh()` to take args (#95)
markmcd Nov 10, 2023
5b0b406
Clean up labels + automation (#100)
keertk Dec 1, 2023
0988543
Update to include the generative service. (#105)
MarkDaoust Dec 12, 2023
4f05500
Update docstrings, fix jpeg support. (#108)
MarkDaoust Dec 13, 2023
0cd555b
Update README.md (#107)
MarkDaoust Dec 13, 2023
07fb91c
Docstring (#110)
MarkDaoust Dec 13, 2023
c6688b7
Fix MM snippet in README (#111)
markmcd Dec 14, 2023
2bdec6a
fix TypeError in count_tokens & count_tokens_async (#123)
Andy963 Dec 15, 2023
b72d107
Fixup (#128)
MarkDaoust Dec 18, 2023
b97aa55
Add basic tools support. (#120)
MarkDaoust Dec 18, 2023
718d716
Fix Javscript -> Python typo in README.md (#132)
luo-anthony Dec 18, 2023
f437f24
Corrected some typos (#131)
thesanju Dec 18, 2023
b12aef7
fix: update links to https://github.com/google/generative-ai-docs in …
mpursley Dec 18, 2023
106daab
Test PRs when project metadata changes (#121)
markmcd Dec 18, 2023
8f05227
aiter, anext not exist error (#127)
Andy963 Dec 19, 2023
15bc434
docs: Correct GenerateContentResponse type documentation, remove asyn…
Hamza-nabil Dec 19, 2023
0a9596f
Fix: List Index out out range with empty parts [] (#138)
Andy963 Dec 19, 2023
b23546f
fix: handle empty string in ChatSession.send_message (#134)
Hamza-nabil Dec 19, 2023
a1e4e16
Update tutorial comments in class GenerativeModel (#116)
YebowenHu Dec 19, 2023
04dbd5f
Import typeddict from typing_extentions (#104)
eavanvalkenburg Dec 20, 2023
9264c68
Update to 0.3.2 for a new release. (#142)
MarkDaoust Dec 20, 2023
9f3feed
Move tests (#141)
MarkDaoust Dec 20, 2023
7698c69
Fix build docs. (#150)
MarkDaoust Dec 23, 2023
bad9517
fix: lock google-auth version to fix #114 (#115)
yihong0618 Jan 8, 2024
0ed30c4
Format build_docs.py (#164)
MarkDaoust Jan 9, 2024
4df472e
docs: Update code in `README.md` and `generate_content` documentati…
Hamza-nabil Jan 10, 2024
ad0e9f2
More readable error message (#163)
ftnext Jan 10, 2024
842550f
Add python 3.12 support. (#165)
MarkDaoust Jan 11, 2024
7abbdf3
Update notebook magics to work with Gemini (#109)
markmcd Jan 11, 2024
b481ea1
Fix duplicate test name. (#167)
MarkDaoust Jan 15, 2024
9ee80d3
Rename model defaults to use gemini-pro (#175)
markmcd Jan 25, 2024
1e67f3d
Add a more explicit error when no `parts` returned (#180)
markmcd Jan 30, 2024
6fe8c12
Semantic retriever (#168)
shilpakancharla Jan 30, 2024
b7a1782
remove retriever.Corpus class in favor of retriever_types.Corpus clas…
MarkDaoust Jan 31, 2024
00ab7fa
Fix list methods, add decode functions. (#186)
MarkDaoust Jan 31, 2024
d0f2742
Add `embed_content_async` implementation (#189)
mayureshagashe2105 Jan 31, 2024
85bfe21
Added create time and update time fields to Corpus, Document, and Chu…
shilpakancharla Jan 31, 2024
76957d9
Wrapping `glm.RelevantChunk` as a class (#190)
shilpakancharla Jan 31, 2024
1b2597e
Adding AQA (GenerateAnswer). (#169)
shilpakancharla Jan 31, 2024
04a56e3
Link to models details page (#194)
kaycebasques Feb 5, 2024
80b171a
Cleanup (#193)
MarkDaoust Feb 5, 2024
b3fa336
Updated naming regex, made naming process simpler. (#191)
shilpakancharla Feb 5, 2024
13b1c9f
inline the docstrings (#198)
MarkDaoust Feb 7, 2024
5e9ff4f
Implement __repr__ for GenerateContentResponse and ChatSession (#202)
aidoskanapyanov Feb 14, 2024
0ed5bbe
Permissions module (#205)
mayureshagashe2105 Feb 17, 2024
bcec1b5
Match docs (#197)
shilpakancharla Feb 20, 2024
c3c90f8
Add ability to configure timeouts (#204)
aidoskanapyanov Feb 20, 2024
607ca14
Fixes #166. Thanks @piresramon. (#208)
MarkDaoust Feb 22, 2024
b28f2d1
Remove init, PEP420PackageFinder handles this + it's breaking local d…
MarkDaoust Feb 22, 2024
d894807
Automatic function calling. (#201)
MarkDaoust Feb 22, 2024
9ce53e0
Update version to 0.4.0 (#222)
MarkDaoust Feb 29, 2024
69cb0ea
Update README.md (#217)
markmcd Feb 29, 2024
4f1ea10
fix: sample code (#228)
lll-lll-lll-lll Mar 5, 2024
84b1a3e
The send_message_async method should call the asynchronous method gen…
xnny Mar 11, 2024
3704fa8
Update version (#237)
MarkDaoust Mar 13, 2024
475bafd
Update build_docs.py (#245)
MarkDaoust Mar 22, 2024
058ac9f
fix docs build script (#254)
MarkDaoust Mar 25, 2024
a987029
fix (#255)
MarkDaoust Mar 25, 2024
8475b9f
Add initial prototype supporting the files API (#249)
MarkDaoust Mar 26, 2024
402db82
Update safety_types.py (#248)
MarkDaoust Mar 27, 2024
2093670
typo (#242)
MarkDaoust Mar 27, 2024
8f79698
Update README.md (#256)
aertoria Mar 27, 2024
ae8f7cc
Update generation_types.py (#239)
Andy963 Mar 27, 2024
a187374
Add additional functionalities with files SDK (#260)
TYMichaelChen Mar 28, 2024
6b281da
Finish Semantic Retriever. (#230)
shilpakancharla Mar 28, 2024
6967517
Import cleanup (#259)
MarkDaoust Mar 28, 2024
fcec2a8
Add basic SI and tool_config support (#257)
MarkDaoust Mar 28, 2024
0778d56
Simply the Python SDK README (#267)
random-forests Apr 1, 2024
ba6b439
System instruction (#270)
mayureshagashe2105 Apr 3, 2024
7d2c17e
Function calling mode patch (#271)
mayureshagashe2105 Apr 5, 2024
7726c5c
Add `system_instruction` to model repr (#272)
markmcd Apr 8, 2024
d64610c
Update version.py (#273)
MarkDaoust Apr 8, 2024
59301fb
fix: incorrect type checking (#283)
Yeuoly Apr 13, 2024
948a5a8
Fix an internal test failure (#279)
markmcd Apr 15, 2024
9e6767b
Add JSON mode (#274)
shilpakancharla Apr 15, 2024
37eb4cb
Allow incomplete GenerationConfigDict (#286)
markmcd Apr 16, 2024
1b8fe35
Use generativelanguage v0.6.2 for json mode + update package version.…
MarkDaoust Apr 16, 2024
50f8c12
Responder: Copy function calling code into responder.py (#289)
shilpakancharla Apr 18, 2024
b3a35c1
Support for new `TaskTypes` and `output_dimensionality` param (#285)
mayureshagashe2105 Apr 18, 2024
625e4bd
Fix file uploads (#291)
MarkDaoust Apr 18, 2024
668695e
Update version.py (#293)
MarkDaoust Apr 18, 2024
ca827a8
Update build_docs.py (#298)
MarkDaoust Apr 23, 2024
c206dbb
update_time defined twice hence removing once. (#301)
PandasPirate Apr 25, 2024
780b9e0
Add main async code match test (#299)
mayureshagashe2105 Apr 26, 2024
f63e15d
Update issue templates to point to the Discourse forum (#304)
ymodak Apr 26, 2024
3a9c286
Copy test cases over for new responder.py (#303)
shilpakancharla Apr 26, 2024
8d8e410
Extend permissions service support to Tuned Models (#219)
mayureshagashe2105 May 2, 2024
1efbcef
Return full file details at the end of create. (#314)
MarkDaoust May 3, 2024
c165b20
Count tokens (#315)
MarkDaoust May 3, 2024
a96feda
Add response_schema parameter (#302)
shilpakancharla May 3, 2024
ecb57a5
Add f to f-string (#322)
markmcd May 7, 2024
b094e0f
Add file state (#316)
MarkDaoust May 7, 2024
50c86af
Update client.py (#325)
MarkDaoust May 7, 2024
a89469f
typo (#313)
MarkDaoust May 7, 2024
e09e7f2
Improve schema support (#309)
MarkDaoust May 8, 2024
bb58ab8
Use api_endpoint for uploads (#330)
MarkDaoust May 9, 2024
cc85ce7
Revert "Use api_endpoint for uploads (#330)" (#333)
MarkDaoust May 13, 2024
855f96f
Update version.py (#334)
MarkDaoust May 13, 2024
efead6b
Add support for resumable uploads for File API (#275)
TYMichaelChen May 13, 2024
55cca2f
Update version of generativelanguage to fix timeout errors. (#345)
MarkDaoust May 17, 2024
1b1d883
Restrict Harm category to the sublist only Gemini support (#295)
aertoria May 17, 2024
51d806d
Fix bugs, improve code clarity, and enhance overall reliability acros…
Faisal-Alsrheed May 17, 2024
30337c2
Improve request_options (#297)
MarkDaoust May 17, 2024
3193c3e
Cleanup file data handling. (#321)
MarkDaoust May 17, 2024
472a3e3
Add GenerateContentResponse.to_dict() (#337)
MarkDaoust May 17, 2024
88f7ab3
Fix argument description. (#338)
MarkDaoust May 17, 2024
05877f7
Allow empty contents with count_tokens (#342)
MarkDaoust May 21, 2024
f987fde
improve the no-credentials error message, fail fast for no-credential…
MarkDaoust May 21, 2024
f361642
Enhance functions Documentation and Improve Error Messages (#350)
Faisal-Alsrheed May 21, 2024
6df10a7
Make printing less verbose. (#340)
MarkDaoust May 22, 2024
75b97db
Add video metadata and error to File (#348)
MarkDaoust May 22, 2024
386994a
Quick safety filtering: Allow `safety_settings="block_none"` (#347)
MarkDaoust May 22, 2024
0dca4ce
Add request options to chat. (#341)
MarkDaoust May 22, 2024
2e62fae
Update __init__.py to use the latest model (#362)
logankilpatrick May 27, 2024
f08c789
Add genai.protos (#354)
MarkDaoust May 30, 2024
e2263cb
Handle image mode (#374)
MarkDaoust Jun 3, 2024
7b9758f
Update version.py (#375)
MarkDaoust Jun 3, 2024
5412d24
Explicit Caching (#355)
mayureshagashe2105 Jun 5, 2024
b9d5bc0
Delete .github/ISSUE_TEMPLATE directory (#389)
ryanwilson Jun 11, 2024
8713cfd
Update gapic lib to use 0.6.5 and fix tests (#390)
mayureshagashe2105 Jun 11, 2024
7313e21
Remove duplicate test (#387)
mayureshagashe2105 Jun 13, 2024
dbd5498
remove references to pro-vision (#388)
MarkDaoust Jun 13, 2024
23b81d7
Explicit Caching patch (#377)
mayureshagashe2105 Jun 13, 2024
419a7ce
Accept partial file names (#386)
mayureshagashe2105 Jun 14, 2024
fb29861
Add samples for Files API (#395)
MarkDaoust Jun 26, 2024
8e13711
Add embedding sample (#397)
shilpakancharla Jun 26, 2024
3e281e7
Add sample for JSON controlled generation (#398)
shilpakancharla Jun 26, 2024
63a140b
Code execution (#396)
shilpakancharla Jun 26, 2024
4960f78
Remove extra new line. (#400)
MarkDaoust Jun 27, 2024
7bd2daa
Caching samples (#399)
shilpakancharla Jun 27, 2024
4721b15
Model list and get samples (#404)
shilpakancharla Jun 28, 2024
1ffbcb3
System instructions sample (#407)
shilpakancharla Jun 28, 2024
b6bd3ca
Count tokens samples (#403)
shilpakancharla Jun 28, 2024
7f1ad45
change argument name to model_name (#394)
philippemiron Jun 28, 2024
ebfad33
Adding text generation samples (#405)
shilpakancharla Jun 28, 2024
81aaf35
Add samples for chat (#408)
shilpakancharla Jun 28, 2024
630318b
Rename json_mode.py and create function calling sample (#406)
shilpakancharla Jun 28, 2024
05bfb7f
Add tuned_models samples (#409)
MarkDaoust Jun 29, 2024
a3c963b
Add no json schema sample (#416)
shilpakancharla Jul 1, 2024
235ade7
fix list initialization and redundant parentheses (#412)
PandasPirate Jul 1, 2024
b91cbf2
Adding a note about free tier not available in Europe (#401)
Giom-V Jul 1, 2024
e1c31d7
Update text only promopts (#420)
shilpakancharla Jul 2, 2024
23ce3bd
Add cache_from_name and cache_chat (#413)
shilpakancharla Jul 2, 2024
aa2a88f
Add create_audio and create_text to `samples/files.py` (#414)
shilpakancharla Jul 2, 2024
e113a27
Add safety_settings sample (#415)
shilpakancharla Jul 2, 2024
45fcbdf
Add REST sample for listing and getting models (#421)
shilpakancharla Jul 2, 2024
9282959
Cleanup files.py (#402)
MarkDaoust Jul 3, 2024
9c44f48
format-samples (#410)
MarkDaoust Jul 3, 2024
90d0cdb
fix bug passing single-string safety settings. (#417)
MarkDaoust Jul 3, 2024
63a15fe
Fix pperator conversion. (#419)
MarkDaoust Jul 3, 2024
12774d0
Fix 'ResourceWarning: unclosed <ssl.SSLSocket>' (#422)
MarkDaoust Jul 3, 2024
c7bd5b8
Add model configuration sample (#427)
shilpakancharla Jul 3, 2024
7050366
move SI (#428)
MarkDaoust Jul 3, 2024
9d9da1c
no 's' (#431)
MarkDaoust Jul 3, 2024
cea667e
Fix snippet name. (#432)
MarkDaoust Jul 3, 2024
2005923
Snippet name
MarkDaoust Jul 3, 2024
3b78e31
Fix snippet name.
MarkDaoust Jul 3, 2024
42e968d
Update cache.py (#435)
MarkDaoust Jul 3, 2024
0f7723e
move tuning to tuned_models (#436)
MarkDaoust Jul 3, 2024
85ee8c1
Fix Model dataclass (#439)
rozha Jul 8, 2024
fb033db
Add PngImagePlugin to imports. (#438)
mbanani Jul 8, 2024
13d2f52
Fix typos (#437)
PandasPirate Jul 8, 2024
d9a17ea
Add webp to mimetypes (#440)
MarkDaoust Jul 8, 2024
ae5f1b2
Update tuned_models.py (#441)
MarkDaoust Jul 8, 2024
439ca8e
Check video status. (#442)
MarkDaoust Jul 8, 2024
f1dff9c
Bugfix release 0.7.2
MarkDaoust Jul 8, 2024
b733acb
Add model configuration for rest
shilpakancharla Jul 8, 2024
a4e501e
Sync count tokens examples (#445)
MarkDaoust Jul 9, 2024
cc2a3b7
Fix PIL.Image imports. (#447)
MarkDaoust Jul 9, 2024
0d51b26
Add code execution python sample (#451)
shilpakancharla Jul 10, 2024
712e0e4
Update example to show part types. (#452)
MarkDaoust Jul 10, 2024
351daad
move model_configuration samples (#454)
MarkDaoust Jul 11, 2024
d74189f
Update configure_model_parameters.py
MarkDaoust Jul 11, 2024
8642c8c
move model_configuration samples (#456)
MarkDaoust Jul 11, 2024
7c21486
Format code execution (#457)
shilpakancharla Jul 11, 2024
950a666
Chat REST samples (#449)
shilpakancharla Jul 11, 2024
754d038
Update tuned_models.py (#458)
MarkDaoust Jul 11, 2024
4e1dcd6
Update count_tokens.py (#459)
rachelsaunders Jul 12, 2024
8494231
Formatting (using black) (#460)
Giom-V Jul 17, 2024
3491bfc
Adding count_tokens for rest (#444)
shilpakancharla Jul 17, 2024
e8ad653
add safety settings examples for curl (#433)
shilpakancharla Jul 17, 2024
c5ef6c0
Add markdown docs (#462)
MarkDaoust Jul 17, 2024
0f8f139
Using the `GEMINI_API_KEY` by default instead of the `GOOGLE_API_KEY`…
Giom-V Jul 22, 2024
5b31be7
Add REST embeddings & system_instruction sample (#429)
shilpakancharla Jul 23, 2024
d3ca154
`text_generation` samples for shell (#430)
shilpakancharla Jul 23, 2024
99e5a11
Added curl examples for files (#480)
shilpakancharla Jul 23, 2024
353dc4f
Add other functions to count_tokens (#482)
shilpakancharla Jul 23, 2024
f8b049f
Add pdf samples (#484)
MarkDaoust Jul 23, 2024
695ee95
add audio streaming & pdf examples (#483)
shilpakancharla Jul 23, 2024
b19fc8c
Add function calling REST example (#443)
shilpakancharla Jul 23, 2024
032f78f
Adding JSON schema curl samples (#434)
shilpakancharla Jul 23, 2024
84db061
Caching cURL sample (#455)
Giom-V Jul 24, 2024
87c9b06
rename embeddings -> embed (#487)
MarkDaoust Jul 24, 2024
d0f3359
M
MarkDaoust Jul 24, 2024
74d67ac
Code execution for shell (#491)
shilpakancharla Jul 31, 2024
a79d2aa
Fix example (#494)
MarkDaoust Jul 31, 2024
b5b20ed
make cachig visible, and make imports alphabetical (#493)
MarkDaoust Jul 31, 2024
42d952a
Ce rest (#495)
shilpakancharla Aug 2, 2024
3612328
Fix response_schema sample. (#498)
MarkDaoust Aug 7, 2024
db311dd
Add a README for /samples (#507)
markmcd Aug 14, 2024
a8edb40
Add additional functions to files & count_tokens. (#490)
shilpakancharla Aug 16, 2024
8a29017
REST for tuned models (#496)
shilpakancharla Aug 21, 2024
8a96b86
Use flash more often. (#517)
MarkDaoust Aug 22, 2024
526fe03
Fix the missing closing backticks in CONTRIBUTING (#514)
rakyll Aug 22, 2024
7342a62
Remove DiscussService and TextService (#512)
shilpakancharla Aug 22, 2024
32b754f
remove exit_on_error (#521)
MarkDaoust Aug 23, 2024
e805b24
Expand PIL image support. (#523)
MarkDaoust Aug 27, 2024
e0928fc
Enum (#529)
MarkDaoust Aug 27, 2024
4647e79
Avoid making recommendations about regions in README (#538)
rakyll Sep 6, 2024
836d31a
Add more enum samples. (#543)
MarkDaoust Sep 9, 2024
97019c4
Update controlled_generation.py (#544)
MarkDaoust Sep 9, 2024
9407dcd
upadate version (#545)
MarkDaoust Sep 9, 2024
f03ef2d
update generativelanguage version (#547)
MarkDaoust Sep 10, 2024
1ccbc5a
Expand `.text` error descriptions. (#527)
MarkDaoust Sep 11, 2024
90f8094
Fix default_metadata for files API. (#548)
MarkDaoust Sep 11, 2024
c039446
update version (#554)
MarkDaoust Sep 12, 2024
4f42118
Ensure tests are runnable when standalone (#552)
markmcd Sep 12, 2024
36e001a
Add rev14 parameters and fixes. (#561)
MarkDaoust Sep 23, 2024
8f7f5cb
Update to use google.generativelanguage 0.6.10. (#568)
MarkDaoust Sep 24, 2024
6c8dad1
fix: preserve quality and optimize transfer of prompt images (#570)
PicardParis Sep 24, 2024
d5103eb
Search grounding (#558)
shilpakancharla Sep 24, 2024
be00c19
Remove finish_message (#571)
MarkDaoust Sep 26, 2024
b50341e
Stream file upload (#556)
Hamza-nabil Sep 27, 2024
4354af6
Update default model name (#576)
MarkDaoust Sep 30, 2024
8f77cc6
Removing OAuth from tuning for REST (#579)
shilpakancharla Oct 1, 2024
7546026
update version (#588)
MarkDaoust Oct 7, 2024
c8eadc4
feat: add py.typed (#509)
Goldziher Oct 8, 2024
e9b0cde
Remove references to Pro 1.0 (#600)
MarkDaoust Oct 16, 2024
3d91916
Fix GenerationConfig to match the API. (#609)
MarkDaoust Oct 24, 2024
db8221a
fix: thread-safe discovery API setup (Issues#327) (#583)
Sumeet213 Oct 24, 2024
c16df61
Use double quotes for JSON object keys (#612)
westonruter Oct 29, 2024
0e5c5f2
Add whitespace to generated tables to fix markdown in tables. (#602)
MarkDaoust Oct 29, 2024
a04fcd1
Fix 'argument list too long' error and add couple vision examples (#634)
vishal-dharm Nov 16, 2024
4c00257
Move imports into samples (#638)
MarkDaoust Nov 26, 2024
b8772ed
fix: Pass along model version in GenerateContentResponse (#621)
Annhiluc Nov 26, 2024
5a3ba73
Copy AIS templates from cookbook. (#635)
MarkDaoust Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
'status:awaiting review':
- '**/*'

'component:python sdk':
- '**/*'
86 changes: 86 additions & 0 deletions .github/workflows/samples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Validate samples

on:
pull_request:
types: [opened, synchronize] # new, updates

jobs:
update-python-list:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Get Changed Files
id: changed_files
uses: tj-actions/changed-files@v44
with:
files: |
samples/*.py

- name: Check Python samples
env:
NEW_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
README: samples/README.md
run: |
#!/bin/bash

for file in ${NEW_FILES}; do
echo "Testing $file"
name=$(basename $file)
if [[ -f ${file} ]]; then
# File exists, so needs to be listed.
if ! grep -q $name ${README}; then
echo "Error: Sample not listed in README ($name)"
exit 1
fi
else
# File does not exist, ensure it's not listed
if grep -q $name ${README}; then
echo "Error: Sample should not be listed in README ($name)"
exit 1
fi
fi
done

update-rest-list:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Get Changed Files
id: changed_files
uses: tj-actions/changed-files@v44
with:
files: |
samples/rest/*.sh

- name: Check REST samples
env:
NEW_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
README: samples/rest/README.md
run: |
#!/bin/bash

for file in ${NEW_FILES}; do
echo "Testing $file"
if [[ -f ${file} ]]; then
# File exists, so needs to be listed.
echo $(basename $file)
name=$(basename $file)
if ! grep -q $name ${README}; then
echo "Error: Sample not listed in README ($name)"
exit 1
fi
else
# File does not exist, ensure it's not listed
name=$(basename $file)
if grep -q $name ${README}; then
echo "Error: Sample should not be listed in README ($name)"
exit 1
fi
fi
done
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-label: "status:stale"
close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
stale-issue-message: >
Expand All @@ -35,7 +35,7 @@ jobs:
Please post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-label: "stale"
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days with no activity.
This PR will be closed if no further activity occurs.
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/test_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ on:
paths:
- "google/**"
- "tests/**"
- "samples/**"
- "pyproject.toml"
- "setup.py"
# Allow manual runs
workflow_dispatch:

jobs:
test3_12:
name: Test Py3.12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Run tests
run: |
python --version
pip install .[dev]
python -m unittest
test3_11:
name: Test Py3.11
runs-on: ubuntu-latest
Expand All @@ -23,8 +39,8 @@ jobs:
- name: Run tests
run: |
python --version
pip install -q -e .[dev]
python -m unittest discover --pattern '*test*.py'
pip install .[dev]
python -m unittest
test3_10:
name: Test Py3.10
runs-on: ubuntu-latest
Expand All @@ -36,8 +52,8 @@ jobs:
- name: Run tests
run: |
python --version
pip install -q -e .[dev]
python -m unittest discover --pattern '*test*.py'
pip install -q .[dev]
python -m unittest
test3_9:
name: Test Py3.9
runs-on: ubuntu-latest
Expand All @@ -49,21 +65,22 @@ jobs:
- name: Run tests
run: |
python --version
pip install -q -e .[dev]
python -m unittest discover --pattern '*test*.py'
pytype3_10:
name: pytype 3.10
pip install .[dev]
python -m unittest
pytype3_11:
name: pytype 3.11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Run pytype
run: |
python --version
pip install -q -e .[dev]
pip install .[dev]
pip install -q gspread ipython
touch google/__init__.py # https://github.com/google/pytype/issues/464
pytype
format:
name: Check format with black
Expand All @@ -76,7 +93,7 @@ jobs:
- name: Check format
run: |
python --version
pip install -q -e .
pip install -q .
pip install -q black
black . --check

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/.idea/
/.pytype/
/build/
/docs/api
*.egg-info
.DS_Store
__pycache__
*.iml
/dist/
40 changes: 33 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.

## Contributing A Patch
## Contributing a Patch

1. Submit an issue describing your proposed change to the repo in question.
1. The repo owner will respond to your issue promptly.
Expand All @@ -45,7 +45,7 @@ accept your pull requests.
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.

You can use an API-key, but remember never to same it in your source files.
You can use an API-key, but remember never to save it in your source files.


## Development
Expand All @@ -62,15 +62,40 @@ This "editable" mode lets you edit the source without needing to reinstall the p

### Testing

Use the builtin unittest package:
To ensure the integrity of the codebase, we have a suite of tests located in the `generative-ai-python/tests` directory.

You can run all these tests using Python's built-in `unittest` module or the `pytest` library.

For `unittest`, open a terminal and navigate to the root directory of the project. Then, execute the following command:

```
python -m unittest discover -s tests

# or more simply
python -m unittest
```

Alternatively, if you prefer using `pytest`, you can install it using pip:

```
pip install pytest
```
python -m unittest discover --pattern '*test*.py'

Then, run the tests with the following command:

```
pytest tests

# or more simply
pytest
```


Or to debug, use:

```commandline
```
pip install nose2

nose2 --debugger
```

Expand All @@ -80,7 +105,9 @@ Use `pytype` (configured in `pyproject.toml`)

```
pip install pytype
touch google/__init__.py # https://github.com/google/pytype/issues/464
pytype
rm google/__init__.py
```

### Formatting:
Expand All @@ -98,9 +125,8 @@ black .
python docs/build_docs.py
```


[setup]: https://cloud.google.com/nodejs/docs/setup
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=generativelanguage.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
[auth]: https://cloud.google.com/docs/authentication/getting-started
Loading
Loading