Skip to content

Commit 6a6eb7a

Browse files
committed
Resolve merge conflicts
1 parent f9cb604 commit 6a6eb7a

File tree

1 file changed

+0
-33
lines changed
  • server/api/views/text_extraction

1 file changed

+0
-33
lines changed

server/api/views/text_extraction/views.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@
3131

3232

3333
# TODO: Add docstrings and type hints
34-
<<<<<<< HEAD
3534
def anthropic_citations(client, user_prompt, content_chunks):
36-
=======
37-
def anthropic_citations(client, content_chunks, user_prompt):
38-
>>>>>>> listOfMed
3935
"""
4036
"""
4137

@@ -90,45 +86,16 @@ class RuleExtractionAPIView(APIView):
9086
def get(self, request):
9187
try:
9288

93-
<<<<<<< HEAD
9489
client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
9590

96-
=======
97-
client = anthropic.Anthropic(
98-
api_key=os.getenv("ANTHROPIC_API_KEY"))
99-
100-
user_prompt = """
101-
I'm creating a system to analyze medical research. It processes peer-reviewed papers to extract key details
102-
103-
Act as a seasoned physician or medical professional who treat patients with bipolar disorder
104-
105-
Identify rules for medication inclusion or exclusion based on medical history or concerns
106-
107-
Return an output with the same structure as these examples:
108-
109-
The rule is history of suicide attempts. The type of rule is "INCLUDE". The reason is lithium is the
110-
only medication on the market that has been proven to reduce suicidality in patients with bipolar disorder.
111-
The medications for this rule are lithium.
112-
113-
The rule is weight gain concerns. The type of rule is "EXCLUDE". The reason is Seroquel, Risperdal, Abilify, and
114-
Zyprexa are known for causing weight gain. The medications for this rule are Quetiapine, Aripiprazole, Olanzapine, Risperidone
115-
}
116-
"""
117-
118-
>>>>>>> listOfMed
11991
guid = request.query_params.get('guid')
12092

12193
query = Embeddings.objects.filter(upload_file__guid=guid)
12294

12395
chunks = [{"type": "text", "text": chunk.text} for chunk in query]
12496

125-
<<<<<<< HEAD
12697
texts, cited_texts = anthropic_citations(client, USER_PROMPT, chunks)
12798

128-
=======
129-
texts, cited_texts = anthropic_citations(
130-
client, chunks, user_prompt)
131-
>>>>>>> listOfMed
13299

133100
return Response({"texts": texts, "cited_texts": cited_texts}, status=status.HTTP_200_OK)
134101

0 commit comments

Comments
 (0)