Repository navigation
Ben/category enrichment #32
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
782275c
adding large category ingestion to postgres
benben-ship-it 543c28d
add large category ingestion after profiling
benben-ship-it aab339f
add category enrichment logic
benben-ship-it 138e84d
Merge branch 'eliraz/temporal' of https://github.com/StavPonte11/text…
benben-ship-it 8f8dd75
regenerate uv.lock
benben-ship-it 84117ef
Merge branch 'main' of https://github.com/StavPonte11/text2sql-onboar…
benben-ship-it 06f8203
fix merge problems
benben-ship-it 2a304ac
refiner refactor
benben-ship-it 51a158e
merged from main'
benben-ship-it 6afa9f8
first commit of agent refractoring
benben-ship-it 507bef5
agent refractoring v2
benben-ship-it ed25fb5
agent refractoring comments fixed
benben-ship-it 50fbeae
Resolve merge conflict in finalizer.py
benben-ship-it f910029
pulled from main
benben-ship-it 3d20598
Update refiner to parse JSON from LLM and update mocks
benben-ship-it 5bc589d
Fix flaky tests caused by missing limits and schemas
benben-ship-it 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
Binary file not shown.
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 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 |
|---|---|---|
| @@ -1,8 +1,50 @@ | ||
| import warnings | ||
| import urllib3 | ||
| from langfuse import Langfuse | ||
| from opentelemetry import trace as otel_trace_api | ||
| from agent.config import settings | ||
|
|
||
| # Suppress unverified HTTPS warnings for dev internal endpoints | ||
| urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
| warnings.filterwarnings("ignore", category=urllib3.exceptions.InsecureRequestWarning) | ||
|
benben-ship-it marked this conversation as resolved.
|
||
|
|
||
| langfuse_client = Langfuse( | ||
| public_key=settings.LANGFUSE_PUBLIC_KEY, | ||
| secret_key=settings.LANGFUSE_SECRET_KEY, | ||
| host=settings.LANGFUSE_BASE_URL, | ||
| ) | ||
|
|
||
| # Patch update_current_span and get_current_trace_id to safely no-op when running without an active OpenTelemetry span context | ||
| _orig_update_current_span = langfuse_client.update_current_span | ||
| _orig_get_current_trace_id = langfuse_client.get_current_trace_id | ||
|
|
||
|
|
||
| def _is_valid_langfuse_span(span) -> bool: | ||
| if span is otel_trace_api.INVALID_SPAN: | ||
| return False | ||
| context = span.get_span_context() | ||
| if not context.is_valid or context.is_remote: | ||
| return False | ||
| if not span.is_recording(): | ||
| return False | ||
| return True | ||
|
|
||
|
|
||
| def _safe_update_current_span(*args, **kwargs): | ||
| current_span = otel_trace_api.get_current_span() | ||
| if not _is_valid_langfuse_span(current_span): | ||
| return | ||
| return _orig_update_current_span(*args, **kwargs) | ||
|
|
||
|
|
||
| def _safe_get_current_trace_id(*args, **kwargs): | ||
| current_span = otel_trace_api.get_current_span() | ||
| if not _is_valid_langfuse_span(current_span): | ||
| return None | ||
| return _orig_get_current_trace_id(*args, **kwargs) | ||
|
benben-ship-it marked this conversation as resolved.
|
||
|
|
||
|
|
||
| langfuse_client.update_current_span = _safe_update_current_span | ||
| langfuse_client.get_current_trace_id = _safe_get_current_trace_id | ||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -69,3 +69,4 @@ def get_llm( | |
| temperature=temperature, | ||
| timeout=300.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
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
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.
Uh oh!
There was an error while loading. Please reload this page.