diff --git a/examples/eap_to_quarkus/sampleprompt.py b/examples/eap_to_quarkus/sampleprompt.py new file mode 100644 index 0000000..dc1d252 --- /dev/null +++ b/examples/eap_to_quarkus/sampleprompt.py @@ -0,0 +1,78 @@ +import os +from dotenv import find_dotenv, load_dotenv +from langchain.chat_models import ChatOpenAI +from langchain.prompts import ChatPromptTemplate +import openai + +_ = load_dotenv(find_dotenv()) +openai.api_key = os.environ['OPENAI_API_KEY'] +chat = ChatOpenAI(temperature=0.0, model="gpt-3.5-turbo") + +temp =""" +You have been provided with prior solved examples in {text}. It is time to resolve a similar incident. Find a solution for the issue in {java_code_snippet}. +Make sure it is compatible with Quarkus 3.4.1 as well as Jakarta EE 9 and Java 11. + +Make sure the output is displayed in the diff format like github +""" + +prompt_template = ChatPromptTemplate.from_template(temp) + +modernize_text = """ +You are an expert in Java EAP and Quarkus technologies. You are going to assist with modernizing EAP applications to +Quarkus 3.4.1, Jakarta EE 9, and Java 11. There are some sample scenarios provided below, + +Example 1: +Incident metdata: Stateless scoped bean + +Issue details: + +@Stateless +public class OrderService { + // ... +} + +Resolution: + +@ApplicationScoped +public class OrderService { + // ... +} + +Example 2: +Incident metdata: Stateless scoped bean + +Issue details: + +@Stateless +public class CatalogService { + // ... +} + +Resolution: + +@ApplicationScoped +public class CatalogService { + // ... +} +""" + +modernize_question=""" +Incident metadata: Stateless scoped bean + +Issue details: +``` +@Stateless +public class MemberRegistration { + '....' + '....' +} +``` +""" + +modernize_messages = prompt_template.format_messages( + text=modernize_text, + java_code_snippet=modernize_question) + +modernize_response = chat(modernize_messages) + +print(modernize_response.content) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2ff9331..ca18a66 100644 --- a/requirements.txt +++ b/requirements.txt @@ -76,6 +76,9 @@ nvidia-nccl-cu11==2.14.3 nvidia-nvtx-cu11==11.7.91 openai==0.27.8 openapi-schema-pydantic==1.2.4 +openapi-core==0.18.1 +openapi-schema-validator==0.6.2 +openapi-spec-validator==0.6.0 openllm==0.1.16 openlm==0.0.5 opentelemetry-api==1.17.0