Skip to content

Commit

Permalink
merge: merged dev to switch-to-pg
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedantsahai18 committed Jan 2, 2025
1 parent 3582706 commit e673da0
Show file tree
Hide file tree
Showing 22 changed files with 1,960 additions and 392 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Julep Changelog Generation
run-name: ${{ github.actor }} is generating changelog for the last two weeks using Julep

on:
workflow_dispatch:

jobs:
changelog_generation:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: dev

- name: Setup GitHub CLI
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Collect merged PRs from the last two weeks
id: collect_prs
run: |
if [[ "$OSTYPE" == "darwin"* ]]; then
date_threshold=$(date -v-14d +"%Y-%m-%d")
else
date_threshold=$(date -d '-14 days' +"%Y-%m-%d")
fi
echo "Fetching merged PRs since $date_threshold..."
merged_prs=$(
gh pr list --state merged --json number,title,body,author \
--search "merged:>=$date_threshold" \
--jq 'map({number, title, body, author: .author.login})'
)
if [ -z "$merged_prs" ] || [ "$merged_prs" = "null" ]; then
echo "No merged PRs found in the last two weeks."
echo "pr_data=[]" >> $GITHUB_ENV
echo '{"pr_data": []}' > pr_data.json
exit 0
fi
echo "pr_data=$merged_prs" >> $GITHUB_ENV
echo "$merged_prs" > pr_data.json
- name: Setup Python v3.10.12
uses: actions/setup-python@v5
with:
python-version: "3.10.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install PyYAML julep
- name: Send PR data to Python script
if: steps.collect_prs.outputs.pr_data != '[]'
id: generate_changelog
run: |
if ! python scripts/generate_changelog.py; then
echo "Error: Failed to generate changelog"
exit 1
fi
env:
JULEP_API_KEY: ${{ secrets.JULEP_API_KEY }}
TASK_UUID: ${{ secrets.TASK_UUID }}
AGENT_UUID: ${{ secrets.AGENT_UUID }}

- name: Create Pull Request
if: success() && steps.collect_prs.outputs.pr_data != '[]'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(changelog): update CHANGELOG.md"
title: "Update CHANGELOG.md"
body: "This PR updates the changelog with PRs from the last 2 weeks."
branch: "update-changelog"
delete-branch: true
add-paths: |
CHANGELOG.md
111 changes: 102 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,108 @@
# TODO: Update changelog
# SCRUM-29
<div align="center" id="top">
<img src="https://socialify.git.ci/julep-ai/julep/image?description=1&descriptionEditable=Rapidly%20build%20AI%20workflows%20and%20agents&font=Source%20Code%20Pro&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fjulep-ai%2Fjulep%2Fdev%2F.github%2Fjulep-logo.svg&owner=1&forks=1&pattern=Solid&stargazers=1&theme=Auto" alt="julep" width="640" height="320" />
</div>

<p align="center">
<br />
<a href="https://docs.julep.ai" rel="dofollow">Explore Docs (wip)</a>
·
<a href="https://discord.com/invite/JTSBGRZrzj" rel="dofollow">Discord</a>
·
<a href="https://x.com/julep_ai" rel="dofollow">𝕏</a>
·
<a href="https://www.linkedin.com/company/julep-ai" rel="dofollow">LinkedIn</a>
</p>

<p align="center">
<a href="https://www.npmjs.com/package/@julep/sdk"><img src="https://img.shields.io/npm/v/%40julep%2Fsdk?style=social&amp;logo=npm&amp;link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40julep%2Fsdk" alt="NPM Version"></a>
<span>&nbsp;</span>
<a href="https://pypi.org/project/julep"><img src="https://img.shields.io/pypi/v/julep?style=social&amp;logo=python&amp;label=PyPI&amp;link=https%3A%2F%2Fpypi.org%2Fproject%2Fjulep" alt="PyPI - Version"></a>
<span>&nbsp;</span>
<a href="https://hub.docker.com/u/julepai"><img src="https://img.shields.io/docker/v/julepai/agents-api?sort=semver&amp;style=social&amp;logo=docker&amp;link=https%3A%2F%2Fhub.docker.com%2Fu%2Fjulepai" alt="Docker Image Version"></a>
<span>&nbsp;</span>
<a href="https://choosealicense.com/licenses/apache/"><img src="https://img.shields.io/github/license/julep-ai/julep" alt="GitHub License"></a>
</p>

# Changelog
# **Julep AI Changelog for 12 December 2024**

All notable changes to this project will be documented in this file.
Welcome to the latest Julep AI changelog! We’ve been busy refining and enhancing our systems to ensure a seamless experience for you. Dive into the exciting updates below!

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## **Features**

## [Unreleased]
- **Prometheus Summary for Cozo Queries**:
- A **Summary** metric has been introduced for query latency in `query_metrics_update()` within `counters.py`.
- The `increase_counter()` function has been renamed to `query_metrics_update()` across multiple files for consistency.
- **Why**: To improve performance monitoring and streamline code.
- **Impact**: Enhanced visibility into query performance and simplified codebase.

### Added
- **MMR Search and Configurable Parameters**:
- Introduced MMR search with configurable parameters, including `mmr_strength`, in `gather_messages.py`.
- Updated documentation and OpenAPI spec with new search parameters.
- **Why**: To offer flexible and powerful search capabilities.
- **Impact**: Users can now tailor search functionalities to better meet their needs.

- v0.2 agents platform
- **In-Memory Rate Limiter**:
- Added an in-memory rate limiter to `transition_step` using `RateLimiter` from `utils.py`.
- **Why**: To prevent system overload and ensure stable performance.
- **Impact**: Improved resource management and system reliability.

## **Fixes** 🔧

- **GitHub Action Workflow for Changelog Generation**:
- Fixed issues in the GitHub Action workflow by renaming and reconfiguring the workflow.
- **Why**: To ensure accurate changelog generation and avoid JSON structure errors.
- **Impact**: Streamlined changelog updates and enhanced workflow clarity.

- **Grafana Dashboard and Temporal Metrics Port**:
- Resolved provisioning issues in Grafana dashboards and set a static port for Temporal metrics.
- **Why**: To maintain consistent monitoring and avoid configuration errors.
- **Impact**: Reliable dashboard visualization and metrics tracking.

## **Improvements** 📈

- **Metrics Refactoring**:
- Centralized initialization of `Counter`, `Summary`, and `Histogram` metrics in `counters.py`.
- Updated `query_metrics_update` to handle both sync and async functions.
- **Why**: To simplify metric management and enhance functionality.
- **Impact**: Improved performance tracking and easier maintenance.

- **Async Support in Spider API**:
- Added async support and new methods to the Spider API, along with code refactoring.
- **Why**: To enhance the efficiency and flexibility of web crawling capabilities.
- **Impact**: Faster and more reliable API operations.

## **Performance Enhancements** 🚀

- **Integration with New Cozo RocksDB**:
- Updated configurations to integrate the latest Cozo with RocksDB, enhancing the engine and settings.
- **Why**: To leverage new features and improved performance of the Cozo database.
- **Impact**: Enhanced data processing speed and system robustness.

- **Default Worker Settings**:
- Set default Temporal worker settings for improved concurrency and activity limits.
- **Why**: To optimize task handling and resource allocation.
- **Impact**: More efficient workflow management and reduced latency.

## **Breaking Changes** 💥

- **Deprecated Index References**:
- Removed unused index references from queries across multiple files to handle undefined indices.
- **Why**: To clean up the codebase and avoid potential errors.
- **Impact**: May require updates to dependent queries or scripts.

## **Notes** 📝

- **Attention Developers**: Please ensure you update your configurations and dependencies to align with the latest changes.
- **Known Issues**: Some users might experience temporary delays in search functionalities as new indices are created.

Thank you for using Julep AI! We’re committed to delivering the best possible experience and appreciate your support and feedback. Stay tuned for more updates!

## Contributors

Thank you to all our contributors who helped make this release possible!

- [Dmitry Paramonov](https://github.com/whiterabbit1983) 🐇
- [Ahmad Haidar](https://github.com/Ahmad-mtos) 🚀
- [Diwank Tomar](https://github.com/creatorrr) 🌟
- [Vedant Sahai](https://github.com/Vedantsahai18) 🔥
- [Hamada Salhab](https://github.com/HamadaSalhab) 💡
59 changes: 57 additions & 2 deletions agents-api/agents_api/activities/execute_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
HybridDocSearchRequest,
SystemDef,
TextOnlyDocSearchRequest,
UpdateSessionRequest,
UpdateUserRequest,
VectorDocSearchRequest,
)
from ..common.protocol.tasks import ExecutionInput, StepContext
Expand Down Expand Up @@ -111,10 +113,11 @@ async def execute_system(
await bg_runner()
return res

# Handle create session
if system.operation == "create" and system.resource == "session":
developer_id = arguments.pop("developer_id")
session_id = arguments.pop("session_id", None)
data = CreateSessionRequest(**arguments)
create_session_request = CreateSessionRequest(**arguments)

# In case sessions.create becomes asynchronous in the future
if asyncio.iscoroutinefunction(handler):
Expand All @@ -123,14 +126,66 @@ async def execute_system(
# Run the synchronous function in another process
loop = asyncio.get_running_loop()
return await loop.run_in_executor(
process_pool_executor, partial(handler, developer_id, session_id, data)
process_pool_executor,
partial(
handler,
developer_id=developer_id,
session_id=session_id,
data=create_session_request,
),
)

# Handle update session
if system.operation == "update" and system.resource == "session":
developer_id = arguments.pop("developer_id")
session_id = arguments.pop("session_id")
update_session_request = UpdateSessionRequest(**arguments)

# In case sessions.update becomes asynchronous in the future
if asyncio.iscoroutinefunction(handler):
return await handler()

# Run the synchronous function in another process
loop = asyncio.get_running_loop()
return await loop.run_in_executor(
process_pool_executor,
partial(
handler,
developer_id=developer_id,
session_id=session_id,
data=update_session_request,
),
)

# Handle update user
if system.operation == "update" and system.resource == "user":
developer_id = arguments.pop("developer_id")
user_id = arguments.pop("user_id")
update_user_request = UpdateUserRequest(**arguments)

# In case users.update becomes asynchronous in the future
if asyncio.iscoroutinefunction(handler):
return await handler()

# Run the synchronous function in another process
loop = asyncio.get_running_loop()
return await loop.run_in_executor(
process_pool_executor,
partial(
handler,
developer_id=developer_id,
user_id=user_id,
data=update_user_request,
),
)

# Handle regular operations
if asyncio.iscoroutinefunction(handler):
return await handler(**arguments)

# Run the synchronous function in another process
# FIXME: When the handler throws an exception, the process dies and the error is not captured. Instead it throws:
# "concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending."
loop = asyncio.get_running_loop()
return await loop.run_in_executor(process_pool_executor, partial(handler, **arguments))
except BaseException as e:
Expand Down
3 changes: 3 additions & 0 deletions agents-api/agents_api/activities/task_steps/prompt_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ async def prompt_step(context: StepContext) -> StepOutcome:
for message in prompt
]

# Remove None values from passed_settings (avoid overwriting agent's settings)
passed_settings = {k: v for k, v in passed_settings.items() if v is not None}

# Use litellm for other models
completion_data: dict = {
"model": agent_model,
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/activities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,11 @@ def get_handler(system: SystemDef) -> Callable:
return create_session_query
case ("session", None, "update"):
return update_session_query
case ("session", None, "delete"):
return delete_session_query
# TODO: Add support for create_or_update_session
case ("session", None, "chat"):
return chat
case ("session", None, "history"):
return get_history_query

# TASKS
case ("task", None, "list"):
Expand Down
6 changes: 6 additions & 0 deletions agents-api/agents_api/autogen/Docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ class BaseDocSearchRequest(BaseModel):
populate_by_name=True,
)
limit: Annotated[int, Field(ge=1, le=50)] = 10
"""
The limit of documents to return
"""
lang: Literal["en-US"] = "en-US"
"""
The language to be used for text-only search. Support for other languages coming soon.
"""
metadata_filter: dict[str, Any] = {}
"""
Metadata filter to apply to the search
"""
mmr_strength: Annotated[float, Field(ge=0.0, lt=1.0)] = 0
"""
MMR Strength (mmr_strength = 1 - mmr_lambda)
Expand Down
35 changes: 33 additions & 2 deletions agents-api/agents_api/autogen/Sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,41 @@ class RecallOptions(BaseModel):
populate_by_name=True,
)
mode: Literal["hybrid", "vector", "text"] = "vector"
"""
The mode to use for the search.
"""
num_search_messages: int = 4
"""
The number of search messages to use for the search.
"""
max_query_length: int = 1000
hybrid_alpha: float = 0.7
confidence: float = 0.6
"""
The maximum query length to use for the search.
"""
alpha: Annotated[float, Field(ge=0.0, le=1.0)] = 0.7
"""
The weight to apply to BM25 vs Vector search results. 0 => pure BM25; 1 => pure vector;
"""
confidence: Annotated[float, Field(ge=0.0, le=1.0)] = 0.6
"""
The confidence cutoff level
"""
limit: Annotated[int, Field(ge=1, le=50)] = 10
"""
The limit of documents to return
"""
lang: Literal["en-US"] = "en-US"
"""
The language to be used for text-only search. Support for other languages coming soon.
"""
metadata_filter: dict[str, Any] = {}
"""
Metadata filter to apply to the search
"""
mmr_strength: Annotated[float, Field(ge=0.0, lt=1.0)] = 0
"""
MMR Strength (mmr_strength = 1 - mmr_lambda)
"""


class RecallOptionsUpdate(RecallOptions):
Expand Down
10 changes: 9 additions & 1 deletion agents-api/agents_api/common/protocol/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@
"finish_branch",
"init_branch",
],
"finish_branch": ["wait", "error", "cancelled", "step", "finish", "init_branch"],
"finish_branch": [
"wait",
"error",
"cancelled",
"step",
"finish",
"init_branch",
"finish_branch",
],
} # type: ignore

valid_previous_statuses: dict[ExecutionStatus, list[ExecutionStatus]] = {
Expand Down
Loading

0 comments on commit e673da0

Please sign in to comment.