Skip to content

Commit

Permalink
Merge pull request #6 from EJOOSTEROP/feat_hotel-info
Browse files Browse the repository at this point in the history
  • Loading branch information
EJOOSTEROP authored Jul 19, 2024
2 parents 4fa575a + 82e120b commit 02ad62d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Consider downgrading Python requirement (at least to 3.10, but I dont know how low it can gowhere)

## [0.8.5]

### Added
- Hotel information

### Changed
- Upgrade LLM to GPT 4o mini

## [0.8.4]

### Added
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ disallow_incomplete_defs = true

[tool.poetry]
name = "crewcal"
version = "0.8.4"
version = "0.8.5"
description = "Convert an airline crew schedule pdf into iCalendar format."
authors = ["Erik Oosterop <[email protected]>"]
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPENAI_API_KEY = "YOUR-OPENAI-API-KEY"
4 changes: 2 additions & 2 deletions src/crewcal/llm_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Read the schedule from a pdf file using LLM with OpenAI
to extract flight details in a structured format.
About 0.75 US cents per call in OpenAI API costs.
As at nov 2023 about 0.75 US cents per call in OpenAI API costs.
"""

import json
Expand Down Expand Up @@ -37,7 +37,7 @@ class OpenAISchedule:

schedule_path: str
extracted_schedule: str = ""
llm_model_name: str = "gpt-3.5-turbo"
llm_model_name: str = "gpt-4o-mini-2024-07-18"

def __init__(
self, schedule_path: str, to_json_file: str = "", to_icalendar_file: str = ""
Expand Down
7 changes: 4 additions & 3 deletions src/crewcal/llm_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The information contains a list of duties for an airline crew member. Duties consist of one or more flights. You will represent each duty as a calendar event.
Ignore the section with Hotel Information.
The section with Hotel Information contains no new events. Instead it contains the hotel at destination for some of the flights.
Each event contains the following items:
- Departure date in yyyy-mm-dd format
Expand All @@ -18,11 +18,12 @@
- Destination airport code
- Destination airport name
- Destination timezone
- Arrival date. A '+1' means the next day.
- Arrival date. A '+1' means the next day. Only capture yyyy-mm-dd format.
- Arrival time, the last occurrence of a time for each day. A '+1' means the next day. Only capture HH:mm format.
- List of crew members
- A list of all times found.
- A list of all times found. Only capture HH:mm format.
- List of all airport codes.
- Hotel information at destination. Obtain this from the document section 'Hotel Information'. It includes the name, full address and phone number of the hotel at destination. For some flights this does not exist. In that case keep this part empty.
Always include all items in your output even if they are empty.
"""
2 changes: 2 additions & 0 deletions src/crewcal/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Event(BaseModel):
crew_list: List[str]
list_times: List[str]
list_airport_codes: List[str]
hotel_information: str

def list_airport_pairs(self):
"""Generate a formatted string of airport pairs."""
Expand All @@ -55,6 +56,7 @@ def get_description(self):
self.list_airport_pairs(),
*self.crew_list,
f"\nFlight ends in {self.destination_timezone[-1]} timezone.",
self.hotel_information,
]
)

Expand Down

0 comments on commit 02ad62d

Please sign in to comment.