Add additional relationships - #149
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Prompt rendering uses set iteration over the expanded topics, creating nondeterministic other_topics ordering that can materially vary LLM behavior across runs.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Expands the set of supported chemical→effect relationship types and updates the API/tests/examples to use the new relationship-type taxonomy, enabling richer relationship extraction prompts and classifications across the library.
Changes:
- Replaces the old
Causative/Inhibitiverelationship types with a broader set (e.g.,Causation,Inhibition,Activation,Promotion,Prevention,Induction,Alleviation,Mitigation,Regulation) and adds clearer definitions. - Makes
RelationshipTypeinstances comparable/hashable by positive label (supporting set membership/difference used in prompt building). - Updates tests and examples to the new names and adds dedicated unit tests validating relationship-type invariants and prompt integration.
File summaries
| File | Description |
|---|---|
| tests/test_text_generation.py | Updates existing OpenAI-marked tests to use Causation/Inhibition class names and labels. |
| tests/test_relationship_type.py | Adds new unit tests asserting relationship-type uniqueness, equality/hash behavior, topic coverage, and removals of old class names. |
| src/aoptk/text_generation_api.py | Expands topics to include all relationship types used for prompt exclusions and updates imports/types accordingly. |
| src/aoptk/relationships/relationship_type.py | Implements __eq__/__hash__/__repr__ and introduces the expanded relationship-type classes with updated definitions. |
| examples/find_chemicals_relationships.py | Updates example usage to the new relationship-type class names. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+32
to
+36
| topics = { | ||
| Inhibition(), | ||
| Causation(), | ||
| Activation(), | ||
| Promotion(), |
Co-authored-by: hechth <12066490+hechth@users.noreply.github.com>
LLM improvements
This was referenced Sep 24, 2026
This was
linked to
issues
Sep 24, 2026
This was referenced Sep 24, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #147