Skip to content
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

MERGE development INTO master #78

Merged
merged 33 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8b92e5c
MERGE feature/50-adds-settings-and-updates-history-endpoints INTO dev…
ryaneggz Dec 10, 2023
42fb268
resolve conflicts
ryaneggz Dec 10, 2023
4ab5d4c
Merge branch 'master' into development
ryaneggz Dec 10, 2023
f4f3131
Merge branch 'master' into development
ryaneggz Dec 10, 2023
0eeef77
MERGE Feature/rag chat fixed to not be agent INTO development (#53)
ryaneggz Dec 14, 2023
332fd63
MERGE feature/55-update-ollama-rag-chat INTO development (#56)
ryaneggz Dec 17, 2023
510d7b6
MERGE feature/55-update-ollama-rag-chat INTO development (#57)
ryaneggz Dec 17, 2023
47b3660
resolve conflict
ryaneggz Dec 17, 2023
6f3c85c
Update changelog
ryaneggz Dec 17, 2023
cff7d2a
Update changlog
ryaneggz Dec 17, 2023
cb436c9
fixing the retrieval routes
ryaneggz Dec 23, 2023
fe58875
resolve confclits
ryaneggz Dec 23, 2023
db42f6f
Update changelog
ryaneggz Dec 23, 2023
97ca3c5
Update retrieval controller with file upload
ryaneggz Dec 24, 2023
e932202
Adds better error handling for tools in agent
ryaneggz Dec 25, 2023
e1b3bb5
resolve conflict
ryaneggz Dec 25, 2023
9f79651
Merge branch 'master' into development
ryaneggz Dec 25, 2023
9830f08
Changes made (#62)
ryaneggz Dec 26, 2023
08705b0
MERGE feature/64-retricts-what-can-be-passed-to-settings-and-history …
ryaneggz Dec 27, 2023
f454e06
Resolves conflicts
ryaneggz Dec 27, 2023
e69dd11
Small fix in history controller
ryaneggz Dec 27, 2023
8889ec5
Need to account for tags and title on history and settings
ryaneggz Dec 27, 2023
dd8d341
Switch to a set to be more efficient (#71)
ryaneggz Dec 29, 2023
604ec70
A couple adjustments
ryaneggz Dec 29, 2023
1729ff8
reslve conflicts
ryaneggz Dec 29, 2023
dc1aeaf
Had to update the PINECONE_KEY to PINECONE_API_KEY
ryaneggz Dec 29, 2023
2439769
Had to do some updates
ryaneggz Dec 29, 2023
e032315
Resolve conflicts
ryaneggz Dec 29, 2023
b8b0046
update HistoryController with user_id for webhook
ryaneggz Dec 31, 2023
6cad5c3
Update changelog
ryaneggz Dec 31, 2023
ac4dc5d
resolve conflict in changelog
ryaneggz Dec 31, 2023
0ac173d
MERGE feature/76-updates-params-for-ability-to-fetch-from-other-prope…
ryaneggz Dec 31, 2023
2b6f769
resolve conflicts
ryaneggz Dec 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.1.11
### Added
- feature/76-updates-params-for-ability-to-fetch-from-other-properties (2023-12-31)

## 1.1.10
### Added
- Updates HistoryController constructor to include a user_id as request alternative. (2023-12-30)
Expand Down Expand Up @@ -35,7 +39,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## 1.1.2
### Added

- feature/55-update-ollama-rag-chat (2023-12-17)

## 1.1.1
Expand Down
21 changes: 15 additions & 6 deletions promptengineers/fastapi/controllers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ def __init__(
##############################################################
### Create Chat History
##############################################################
async def index(self, page: int = 1, limit: int = 10):
result = await self.history_service.list_docs(
{'user_id': ObjectId(self.user_id)},
limit,
page
)
async def index(self, page: int = 1, limit: int = 10, **kwargs):
# Base query with user_id
query = {'user_id': ObjectId(self.user_id)}

# Add additional filters passed as keyword arguments
for key, value in kwargs.items():
if value is not None: # Ensure that a value is provided for the filter
# Convert to ObjectId if necessary, for example, if key ends with "_id"
if key in {'setting'}:
query[key] = ObjectId(value)
else:
query[key] = value

# Get the result from the history_service
result = await self.history_service.list_docs(query, limit, page)
return result

##############################################################
Expand Down
52 changes: 27 additions & 25 deletions promptengineers/fastapi/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,34 @@ def get_controller(request: Request) -> HistoryController:
response_model=ResponseHistoryIndex
)
async def list_chat_histories(
page: int = 1,
limit: int = 50,
controller: HistoryController = Depends(get_controller),
page: int = 1,
limit: int = 50,
setting: str = None,
controller: HistoryController = Depends(get_controller),
):
"""List histories"""
try:
result = await controller.index(page, limit)
# Format Response
data = json.dumps({
'histories': result
}, cls=JSONEncoder)
return Response(
content=data,
media_type='application/json',
status_code=200
)
except HTTPException as err:
logger.error(err.detail)
raise
except BaseException as err:
tb = traceback.format_exc()
logger.error("[list_chat_histories]: %s\n%s", err, tb)
raise HTTPException(
status_code=500,
detail=f"An unexpected error occurred. {str(err)}"
) from err
"""List histories"""
try:
# Forward the setting_id and any additional parameters to the controller's index method
result = await controller.index(page, limit, setting=setting)
# Format Response
data = json.dumps({
'histories': result
}, cls=JSONEncoder)
return Response(
content=data,
media_type='application/json',
status_code=200
)
except HTTPException as err:
logger.error(err.detail)
raise
except BaseException as err:
tb = traceback.format_exc()
logger.error("[list_chat_histories]: %s\n%s", err, tb)
raise HTTPException(
status_code=500,
detail=f"An unexpected error occurred. {str(err)}"
) from err

#################################################
# Create Chat History
Expand Down
2 changes: 1 addition & 1 deletion promptengineers/fastapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def show(

# Format Response
data = json.dumps({
**result
'setting': result
}, cls=JSONEncoder)
return Response(
content=data,
Expand Down