Skip to content

Commit 5113bae

Browse files
authored
Merge pull request #1847 from oracle-devrel/feat/update-hr-goal-alignment
feat(hr-goal-alignment): sync all updated files
2 parents bc655c9 + e797d06 commit 5113bae

20 files changed

+750
-219
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
**/__pycache__/
22
venv/
3-
files/venv/
4-
**/config.py
3+
config.py
54
.DS_Store
65
data/
76
*.log
87
*.txt
8+
!requirements.txt

ai/generative-ai-service/hr-goal-alignment/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ See [LICENSE](./LICENSE) for more details.
2828

2929
---
3030

31+
> ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
3132
3233

3334
## Disclaimer
3435

35-
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
36+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.

ai/generative-ai-service/hr-goal-alignment/files/Org_Chart.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
import streamlit as st
32
from urllib.parse import quote, unquote
43

@@ -100,7 +99,7 @@ def create_org_chart():
10099
"""
101100

102101
# Display the chart with HTML component
103-
st.components.v1.html(html_chart, height=520, scrolling=True) # type: ignore
102+
st.components.v1.html(html_chart, height=520, scrolling=True)
104103

105104
# Show details section for selected employee
106105
# ------------------------------------------------------------
@@ -182,5 +181,5 @@ def chip_style(val):
182181
else "background-color:#f8d7da;font-weight:bold"
183182
)
184183

185-
styled = goals_pretty.style.applymap(chip_style, subset=[LABEL_COL]) # type: ignore
184+
styled = goals_pretty.style.applymap(chip_style, subset=[LABEL_COL])
186185
st.dataframe(styled, use_container_width=True, hide_index=True)

ai/generative-ai-service/hr-goal-alignment/files/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The system integrates with Oracle Database and uses OCI's Generative AI models t
5151
├── utils.py
5252
├── requirements.txt
5353
└── README.md
54+
```
5455

5556
## Setup Instructions
5657

ai/generative-ai-service/hr-goal-alignment/files/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
import streamlit as st
32
from pathlib import Path
43

@@ -30,4 +29,4 @@
3029

3130

3231
pg = st.navigation(pages)
33-
pg.run()
32+
pg.run()

ai/generative-ai-service/hr-goal-alignment/files/config_template.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
# config_template.py
32

43
# === OCI Configuration ===

ai/generative-ai-service/hr-goal-alignment/files/course_vector_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
from typing import List, Dict, Optional
32
from langchain_community.vectorstores import OracleVS
43
import os
@@ -13,7 +12,6 @@
1312
from langchain_text_splitters import RecursiveCharacterTextSplitter
1413
from langchain_community.embeddings import OCIGenAIEmbeddings
1514
from langchain_core.documents import Document
16-
from langchain_community.vectorstores.utils import DistanceStrategy
1715

1816
# Use the project's config file
1917
import config
@@ -62,7 +60,7 @@ def _initialize_vector_store(self) -> OracleVS:
6260
client=self.db_conn, # Use the connection passed in __init__
6361
embedding_function=self.embeddings, # Use the embeddings initialized in __init__
6462
table_name=config.VECTOR_TABLE_NAME, # Use table name from project config
65-
distance_strategy=DistanceStrategy.COSINE
63+
distance_strategy="COSINE"
6664
)
6765

6866
# LLM initialization removed.
@@ -169,3 +167,5 @@ def similarity_search(self, query: str, k: int = 5) -> List[Document]:
169167
except Exception as e:
170168
logger.error(f"Error during similarity search: {e}", exc_info=True)
171169
return []
170+
171+

ai/generative-ai-service/hr-goal-alignment/files/data_ingestion_courses.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
import logging
32
import sys
43
import oracledb

ai/generative-ai-service/hr-goal-alignment/files/gen_ai_service/inference.py

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Copyright (c) 2025 Oracle and/or its affiliates.
21
import json
32
import logging
43
import sys
@@ -53,7 +52,8 @@ def recommend_courses(profile, feedback) -> dict:
5352
model = get_llm_model()
5453
response = {}
5554
try:
56-
response = model.with_structured_output(schema).invoke(
55+
# Get raw output first for debugging
56+
raw_output = model.invoke(
5757
[
5858
SystemMessage(content=prompt_sys),
5959
HumanMessage(
@@ -63,10 +63,27 @@ def recommend_courses(profile, feedback) -> dict:
6363
),
6464
]
6565
)
66+
logger.info(f"Raw LLM response before parsing:\n{raw_output}")
67+
# Now parse the structured output
68+
result = model.with_structured_output(schema).invoke(
69+
[
70+
SystemMessage(content=prompt_sys),
71+
HumanMessage(
72+
content=prompt_user.format(
73+
EMPLOYEE_PROFILE=profile, MANAGER_FEEDBACK=feedback
74+
)
75+
),
76+
]
77+
)
78+
if result is None:
79+
logger.warning("GenAI model response couldn't be parsed into the expected schema.")
80+
logger.warning("Consider inspecting the raw output.")
81+
else:
82+
response = dict(result) if not isinstance(result, dict) else result
6683
except Exception as e:
6784
logger.error(f"Error during recommended_courses execution: {e}")
68-
69-
return response # type: ignore
85+
logger.info(f"Returning response from recommend_courses: {response}")
86+
return response
7087

7188

7289

@@ -82,7 +99,7 @@ def classify_smart_goal(goal_description) -> dict:
8299
except Exception as e:
83100
logger.error(f"Error during recommended_courses execution: {e}")
84101

85-
return json.loads(response.content) # type: ignore
102+
return json.loads(response.content)
86103

87104

88105
prompt_sys = """
@@ -133,6 +150,58 @@ def classify_smart_goal(goal_description) -> dict:
133150
DO NOT wrap your response in code blocks, backticks, or any other formatting. Return ONLY the raw JSON object itself.
134151
"""
135152

153+
154+
new_prompt_user = """
155+
Based on the following information about an employee and their performance, recommend appropriate training courses.
156+
157+
**Employee Profile:**
158+
{EMPLOYEE_PROFILE}
159+
160+
**Manager Feedback:**
161+
{MANAGER_FEEDBACK}
162+
163+
Your task:
164+
165+
1. Identify exactly 3 skill-based focus areas for this employee to develop, prioritized according to:
166+
- The most critical issues raised in the manager's feedback
167+
- Then their job title and core responsibilities
168+
- Then existing skills and experience level
169+
170+
2. For each focus area, recommend exactly 2 course titles that:
171+
- Explicitly include difficulty level in the title using: "(Beginner)", "(Intermediate)", or "(Advanced)"
172+
- Address the skill gap clearly
173+
- Are appropriate for the employee's experience
174+
175+
**Output Format:**
176+
177+
Return ONLY a JSON object with a single key: `"recommended_courses"`
178+
- This key must map to an object
179+
- Each key in that object is a focus area (string)
180+
- Each value is a list of exactly two course titles (strings)
181+
182+
**Example:**
183+
{
184+
"recommended_courses": {
185+
"Strategic Communication": [
186+
"Influential Communication for Technical Professionals (Intermediate)",
187+
"Executive Presence and Presentation Skills (Advanced)"
188+
],
189+
"Technical Leadership": [
190+
"Leading High-Performance Technical Teams (Intermediate)",
191+
"Strategic Technical Decision Making (Advanced)"
192+
],
193+
"Project Estimation": [
194+
"Fundamentals of Project Estimation (Beginner)",
195+
"Advanced Techniques in Project Scoping and Estimation (Intermediate)"
196+
]
197+
}
198+
}
199+
200+
⚠️ Do NOT include any explanations, markdown formatting, backticks, or extra text. Only return the raw JSON object as shown.
201+
"""
202+
203+
204+
136205
prompt_user = """
137206
Based on the following information about an employee and their performance, recommend appropriate training courses:
138207

0 commit comments

Comments
 (0)