-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Implement optimization code paths and functionality for initial release #140
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
Open
andrewklatzke
wants to merge
40
commits into
main
Choose a base branch
from
aklatzke/AIC-2263/sdk-dx-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
9859d08
feat: implements optimize method in SDK, code moved
andrewklatzke 1712e4f
feat: implementation of agent optimization + tests
andrewklatzke ea596a7
feat: implement ability to use completions or agents for judge calls
andrewklatzke 2fd55e2
feat: all logs -> debug
andrewklatzke 8481690
fix: lints + structured output tool rename
andrewklatzke f8e5509
fix: lint + missed variable rename
andrewklatzke c032aaf
fix: sort imports
andrewklatzke aee6aa7
fix: lint
andrewklatzke 59c7ac7
chore: break up long lines, add spaces where necessary
andrewklatzke 59f03f2
chore: break up another long line
andrewklatzke e2ff561
chore: fix on_turn path
andrewklatzke af2dd03
chore: move prompts to own file, better debug info
andrewklatzke ea43575
chore: update tests, fix cursor feedback
andrewklatzke 2fecd54
feat: implements LD API client, optimize_from_config path
andrewklatzke d3e1f96
feat: partially implement optimize_from_config
andrewklatzke 44c8c59
feat: ground truth optimization path
andrewklatzke 8f9f1e2
feat: prevent overfitting via prompt changes and post-processing
andrewklatzke a17fd6e
chore: remove some dead code
andrewklatzke 67fdbf1
chore: remove provided_tool_handlers code
andrewklatzke 3042984
fix: adjust iteration logic so validation doesn't consume them
andrewklatzke 288336e
feat: implement latency & token tracking for optimizations
andrewklatzke 5d76276
feat: add optimization for duration
andrewklatzke 4cb8859
feat: add auto-commit option
andrewklatzke ba369a2
chore: add tests
andrewklatzke 149aa76
chore: various fixes, improvements for optimization package
andrewklatzke 31c8385
feat: add shared dataclass for calls so they can be handled by same h…
andrewklatzke 55674ae
chore: improve call config, context so they're passable as a single t…
andrewklatzke 8f3468f
fix: success path + add test, cursor feedback
andrewklatzke 7074cfa
feat: dx improvements for optimization package
andrewklatzke a386a27
chore: update types for lint
andrewklatzke 8d1a868
lint, cursor feedback
andrewklatzke 937542a
chore: additional lint
andrewklatzke 8b3c69f
chore: rename package, imports, and address security review
andrewklatzke f7ce6d3
merge + conflicts
andrewklatzke 7468372
chore: cursor feedback, remove unnecessary log of response
andrewklatzke a387f83
chore: fix readme inconsistency
andrewklatzke 312161f
chore: add retry logic and structural validation for variations
andrewklatzke 542c135
chore: remove coolnames, implement generate_slug() cleanup unused files
andrewklatzke 3bce893
chore: removes cleanup unused tool function, remove additionalProperties
andrewklatzke e8c6692
feat: add token limit handling
andrewklatzke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| """LaunchDarkly AI SDK — optimization. | ||
|
|
||
| This package will provide helpers to run selected tools against the LaunchDarkly API from SDK-based workflows. | ||
| """ | ||
|
|
||
| from ldai.tracker import TokenUsage | ||
|
|
||
| from ldai_optimizer.client import OptimizationClient | ||
| from ldai_optimizer.dataclasses import ( | ||
| AIJudgeCallConfig, | ||
| GroundTruthOptimizationOptions, | ||
| GroundTruthSample, | ||
| LLMCallConfig, | ||
| LLMCallContext, | ||
| OptimizationContext, | ||
| OptimizationFromConfigOptions, | ||
| OptimizationJudge, | ||
| OptimizationJudgeContext, | ||
| OptimizationOptions, | ||
| OptimizationResponse, | ||
| ToolDefinition, | ||
| ) | ||
| from ldai_optimizer.ld_api_client import LDApiError | ||
|
|
||
| __version__ = "0.0.0" | ||
|
|
||
| __all__ = [ | ||
| '__version__', | ||
| 'AIJudgeCallConfig', | ||
| 'GroundTruthOptimizationOptions', | ||
| 'GroundTruthSample', | ||
| 'LDApiError', | ||
| 'LLMCallConfig', | ||
| 'LLMCallContext', | ||
| 'OptimizationClient', | ||
| 'OptimizationContext', | ||
| 'OptimizationFromConfigOptions', | ||
| 'OptimizationJudge', | ||
| 'OptimizationJudgeContext', | ||
| 'OptimizationOptions', | ||
| 'OptimizationResponse', | ||
| 'TokenUsage', | ||
| 'ToolDefinition', | ||
| ] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| """Word lists for slug generation. | ||
|
|
||
| Adjectives and nouns curated from the coolname package's word files | ||
| (Apache-2.0 licensed). Used by generate_slug() to produce | ||
| ``adjective-noun`` variation keys (e.g. ``blazing-lobster``). | ||
|
|
||
| 640 × 454 possible combinations from the full coolname corpus would be | ||
| overkill; ~100 × ~100 = ~10 000 combinations is sufficient given that | ||
| _commit_variation already appends a hex suffix on collisions. | ||
| """ | ||
|
|
||
| _ADJECTIVES: tuple = ( | ||
| # appearance / texture | ||
| "blazing", "bouncy", "brawny", "chubby", "curvy", "elastic", "ethereal", | ||
| "fluffy", "foamy", "furry", "fuzzy", "glaring", "hairy", "hissing", | ||
| "icy", "luminous", "lumpy", "misty", "noisy", "quiet", "quirky", | ||
| "radiant", "roaring", "ruddy", "shaggy", "shiny", "silent", "silky", | ||
| "singing", "skinny", "smooth", "soft", "spicy", "spiked", "sticky", | ||
| "tall", "venomous", "warm", "winged", "wooden", | ||
| # personality / disposition | ||
| "adorable", "amazing", "amiable", "calm", "charming", "cute", | ||
| "dainty", "easygoing", "elegant", "famous", "friendly", "funny", | ||
| "graceful", "gracious", "happy", "hilarious", "jolly", "jovial", | ||
| "kind", "laughing", "lovely", "mellow", "neat", "nifty", "noble", | ||
| "popular", "pretty", "refreshing", "spiffy", "stylish", "sweet", | ||
| "tactful", "whimsical", | ||
| # character / trait | ||
| "adventurous", "ambitious", "audacious", "bold", "brave", "cheerful", | ||
| "curious", "daring", "determined", "eager", "enthusiastic", "faithful", | ||
| "fearless", "fierce", "generous", "gentle", "gleeful", "grateful", | ||
| "hopeful", "humble", "intrepid", "lively", "loyal", "merry", | ||
| "mysterious", "optimistic", "passionate", "polite", "proud", "rebel", | ||
| "relaxed", "reliable", "resolute", "romantic", "sincere", "spirited", | ||
| "stalwart", "thankful", "upbeat", "valiant", "vigorous", "vivacious", | ||
| "zealous", "zippy", | ||
| # quality / impressiveness | ||
| "ancient", "awesome", "brilliant", "classic", "dazzling", "fabulous", | ||
| "fantastic", "glorious", "legendary", "magnificent", "majestic", | ||
| "marvellous", "miraculous", "phenomenal", "remarkable", "splendid", | ||
| "wonderful", | ||
| # size | ||
| "colossal", "enormous", "gigantic", "huge", "massive", "tiny", | ||
| "towering", | ||
| ) | ||
|
|
||
| _NOUNS: tuple = ( | ||
| # common mammals | ||
| "badger", "bat", "bear", "beaver", "bison", "bobcat", "buffalo", | ||
| "capybara", "cheetah", "chipmunk", "coyote", "dingo", "dormouse", | ||
| "elephant", "ermine", "ferret", "fox", "gazelle", "gibbon", "gorilla", | ||
| "groundhog", "hamster", "hare", "hedgehog", "hippo", "horse", | ||
| "hyena", "jaguar", "kangaroo", "koala", "leopard", "lion", "lynx", | ||
| "mammoth", "marmot", "meerkat", "mongoose", "monkey", "moose", | ||
| "otter", "panda", "panther", "porcupine", "puma", "rabbit", | ||
| "raccoon", "rhinoceros", "seal", "skunk", "sloth", "squirrel", | ||
| "tiger", "walrus", "weasel", "whale", "wolf", "wombat", | ||
| "wolverine", "zebra", | ||
| # birds | ||
| "condor", "crane", "crow", "dove", "eagle", "falcon", "flamingo", | ||
| "hawk", "heron", "hummingbird", "kingfisher", "macaw", "magpie", | ||
| "ostrich", "owl", "parrot", "peacock", "pelican", "penguin", | ||
| "phoenix", "puffin", "raven", "robin", "sparrow", "starling", | ||
| "stork", "swan", "toucan", "vulture", | ||
| # reptiles / amphibians / fish | ||
| "cobra", "crocodile", "gecko", "iguana", "jellyfish", "lobster", | ||
| "narwhal", "octopus", "orca", "python", "rattlesnake", "salmon", | ||
| "seahorse", "shark", "snake", "squid", "tortoise", "turtle", | ||
| "viper", | ||
| # legendary / breed | ||
| "basilisk", "chimera", "chupacabra", "dragon", "griffin", | ||
| "kraken", "pegasus", "unicorn", "wyvern", | ||
| "beagle", "bulldog", "collie", "corgi", "dalmatian", "husky", | ||
| "labrador", "poodle", "rottweiler", | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't block on this but all other launchdarkly python packages have the launchdarkly-* name.