-
Notifications
You must be signed in to change notification settings - Fork 34
Support citation in databricks-dspy #177
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds citation support to databricks-dspy by implementing citation-aware types and streaming functionality. The changes enable Databricks users to leverage Anthropic's citation API for tracking source references in generated text.
- Introduces
DatabricksDocument
andDatabricksCitations
types for handling document sources and extracted citations - Adds streaming support with
DatabricksStreamListener
to process citation data from real-time responses - Provides comprehensive test coverage for document handling, citation processing, and streaming functionality
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/databricks_dspy/__init__.py |
Exports new citation and document types along with streaming listener |
src/databricks_dspy/adapters/__init__.py |
Module initialization for citation and document adapters |
src/databricks_dspy/adapters/types/citation.py |
Core citation type implementation with validation and formatting |
src/databricks_dspy/adapters/types/document.py |
Document type for citation-enabled content sources |
src/databricks_dspy/streaming/__init__.py |
Streaming module initialization |
src/databricks_dspy/streaming/streaming_listener.py |
Stream listener for processing citation chunks |
tests/unit_tests/adapters/types/test_citation.py |
Comprehensive test suite for citation functionality |
tests/unit_tests/adapters/types/test_document.py |
Test suite for document type validation and formatting |
tests/unit_tests/streaming/test_streaming.py |
Integration tests for citation streaming functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
integrations/dspy/src/databricks_dspy/streaming/streaming_listener.py
Outdated
Show resolved
Hide resolved
integrations/dspy/src/databricks_dspy/streaming/streaming_listener.py
Outdated
Show resolved
Hide resolved
integrations/dspy/src/databricks_dspy/adapters/types/document.py
Outdated
Show resolved
Hide resolved
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.
Since we have merged the one in DSPy, I think we can close this PR?
Move stanfordnlp/dspy#8721 so that Databricks users can use Anthropic citation easily.