| Failure Mode | Failure Rate |
|---|---|
| Incomplete Answer | 10.5% (2/19) |
| Safety Violations | 0.0% (0/19) |
| Unrealistic Tools | 0.0% (0/19) |
| Overcomplicated Solution | 0.0% (0/19) |
| Missing Context | 5.3% (1/19) |
| Poor Quality Tips | 15.8% (3/19) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| synthetic_records = [] | |
| assert isinstance(synthetic_records, list) and len(synthetic_records) >= 20, \ | |
| "Gemini returned an unexpected format. Re-run or adjust the prompt." | |
| # Traceback (most recent call last): | |
| # File "<python-input-1>", line 1, in <module> | |
| # assert isinstance(synthetic_records, list) and len(synthetic_records) >= 20, \ | |
| # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| # AssertionError: Gemini returned an unexpected format. Re-run or adjust the prompt. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from collections import defaultdict | |
| def build_frequency_counts(text: str, n: int = 2) -> dict[tuple[list[str]], dict[str, int]]: | |
| if n < 1 or n > len(text): | |
| print(f"Error: n should be within 1 and {len(text)}, instead it is: {n}") | |
| sys.exit(1) | |
| counts = defaultdict(lambda: defaultdict(int)) # nested dict w/ a value set to 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| def extract_ngrams(text: str, n: int = 2) -> list[str]: | |
| if n < 1 or n > len(text): | |
| print(f"Error: n should be within 1 and {len(text)}, instead it is: {n}") | |
| sys.exit(1) | |
| if n == 1: | |
| return list(text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| overall_failure_rate = 0.21052631578947367 | |
| f"Overall failure rate: {rate * 100:.2f}%" | |
| # => 'Overall failure rate: 21.05%' | |
| f"Overall failure rate: {rate:.2%}" | |
| # => 'Overall failure rate: 21.05%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| @dataclass | |
| class FailureMode: | |
| name: str | |
| evaluation_criteria: str | |
| failure_modes = [ | |
| FailureMode(name="incomplete_answer", evaluation_criteria="..."), | |
| FailureMode(name="safety_violations", evaluation_criteria="..."), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file specifies files that are *not* uploaded to Google Cloud Platform | |
| # using gcloud. It follows the same syntax as .gitignore, with the addition of | |
| # "#!include" directives (which insert the entries of the given .gitignore-style | |
| # file at that point). | |
| # | |
| # For more information, run: | |
| # $ gcloud topic gcloudignore | |
| # | |
| .gcloudignore | |
| # If you would like to upload your .git directory, .gitignore file or files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| p RACTOR_COUNT: Ractor.count # => 1 | |
| p IS_MAIN_RACTOR: Ractor.main? # => true | |
| p Ractor.main # => #<Ractor:#1 running> | |
| port = Ractor::Port.new | |
| p port # => #<Ractor::Port to:#1 id:1> | |
| Ractor.new(port) do |port| | |
| p RACTOR_COUNT: Ractor.count # => 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| X = 1 | |
| class Rubybox | |
| def self.x = X | |
| def x = ::X | |
| end | |
| # Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. download a copy of prod db to localhost | |
| # connect to remote redis database and | |
| # download a snapshot of the entire database | |
| # to a local file on your filesystem | |
| # via https://stackoverflow.com/a/61365048/625840 | |
| # docs https://redis.io/docs/manual/cli/#remote-backups-of-rdb-files | |
| redis-cli -u $PROD_REDIS_URL --rdb dump.rdb |
NewerOlder