Skip to content

Create initial package structure#1

Merged
prithvikannan merged 1 commit intomainfrom
repo-scaffolding
Oct 17, 2024
Merged

Create initial package structure#1
prithvikannan merged 1 commit intomainfrom
repo-scaffolding

Conversation

@prithvikannan
Copy link
Copy Markdown
Contributor

@prithvikannan prithvikannan commented Oct 17, 2024

Create initial package structure with src/ folder to maintain the core of the repo, and integrations/ folder for partner integrations.

Signed-off-by: Prithvi Kannan <prithvi.kannan@databricks.com>
@prithvikannan prithvikannan merged commit f5d5948 into main Oct 17, 2024
Stephen0512 pushed a commit to ContinuousAnalysis/databricks-ai-bridge that referenced this pull request Feb 22, 2026
…atdatabricks-128

Fix: Allow custom client to be passed to ChatDatabricks

This commit addresses issue databricks#128 by modifying the `__init__` method of the `ChatDatabricks` class to allow a custom client to be passed in via the constructor.

Previously, any client passed in the constructor would be overwritten by the default client. With this change:
- If a `client` is provided in `kwargs`, that client instance is used.
- Otherwise, the client is initialized using `get_deployment_client(self.target_uri)`.

A new unit test, `test_chat_model_with_custom_client`, has been added to `integrations/langchain/tests/unit_tests/test_chat_models.py` to verify this functionality. The test ensures that the provided custom client is correctly assigned and its methods are called when the `ChatDatabricks` instance makes predictions.
dhruv0811 added a commit that referenced this pull request Feb 26, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Feb 26, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Feb 26, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Feb 26, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Mar 3, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Mar 3, 2026
…re catches

Review feedback from Ann (comments #3-7):
- Remove unused pytestmark from conftest.py (#3)
- Add multi-server test: UC + VS in DatabricksMultiServerMCPClient (#4)
- Narrow conftest fixture catches: ExceptionGroup with McpError NOT_FOUND
  check instead of bare Exception — re-raises non-NOT_FOUND errors (#6)
- Revert ty/type-ignore changes to non-test files (chat_models.py, lakebase.py,
  checkpoint.py) — not in scope for this PR (#1, #2)

Error path tests across all 3 layers (#7):
- Core: bad function (McpError BAD_REQUEST not found), bad tool name
  (McpError BAD_REQUEST malformed), wrong args (McpError missing parameter)
- OpenAI Toolkit: bad function (ValueError wrapping), bad tool (ExceptionGroup),
  wrong args (ExceptionGroup)
- OpenAI Agents: bad function (McpError), bad tool (McpError), wrong args (UserError)
- LangChain: bad function (ExceptionGroup > McpError), wrong args (McpError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dhruv0811 added a commit that referenced this pull request Apr 29, 2026
Per review on PR #425. Skipping #3 (trim) and #4 (conv_id naming) —
addressed separately.

#1 Drop owner_pod_id; ownership via heartbeat CAS on attempt_number
- Remove owner_pod_id column from Response model
- heartbeat_response(response_id, expected_attempt_number) CAS-checks
  the attempt_number column. If a heartbeat write returns 0 rows, the
  prior owner has been bumped by another pod's claim and the heartbeat
  task knows to stop.
- _heartbeat() context manager takes attempt_number; passes it through
  from _run_background_stream / _run_background_invoke.
- claim_stale_response() no longer takes a pod parameter.
- _POD_LOG_ID retained for log-line identity only (not stored in DB).

#2 Simplify prose recovery to json.dumps the events array
- _build_prose_recovery_message: was ~110 LOC structural walker
  (function_call/output pairs, narrative messages, partial-text
  reassembly). Now ~15 LOC: filter events by prior_attempt_number,
  json.dumps them, wrap in a directive prompt asking the model to
  figure out what's done vs interrupted.

#5 Drop _inject_conversation_id
- The function was defensive injection of response_id into
  context.conversation_id when no client anchor was supplied. With
  rotation handling resume, and templates / chatbot consistently
  setting conv_id, the injection was redundant.

Top-level review: proactive stale-scan loop with jitter
- New _stale_response_scanner_loop: every ~30s ± 50% jitter, queries
  responses for in_progress rows with stale heartbeats and tries to
  claim+resume them. The proactive counterpart to lazy-on-GET claim;
  ensures crashed responses get recovered even if no client polls.
- find_stale_response_ids repository function with LIMIT 50.
- Spawned in the FastAPI lifespan alongside init_db; cancelled on
  shutdown.
- Settings: stale_scan_interval_seconds=30.0,
  stale_scan_jitter_fraction=0.5.

#6 Document /_debug/kill_task in AGENTS.md
- New §4.4 explaining the test-only debug endpoint, env-var gating,
  what state it leaves the row in.

AGENTS.md updates:
- ER diagram: drop owner_pod_id, annotate attempt_number as CAS guard.
- New §3.5 documenting the proactive scanner with mermaid flowchart.
- §4.3 includes new scanner settings.

Tests: 110 pass. Ruff/format/ty all clean.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant