⚠
️ DEPRECATED GITLAB INSTANCE
⚠
️ This GitLab is now read-only for reference. Please use
https://gitlab.iauro.co
for all new work.
Migration completed on September 17, 2025
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pratiksha-Patil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pratiksha Patil
Pratiksha-Patil
Commits
0976d334
Commit
0976d334
authored
Jul 22, 2025
by
Pratiksha Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5th Assignment of OpenAI & Claude Integration
parent
fd931f89
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
openai/.env
openai/.env
+2
-0
openai/main.py
openai/main.py
+45
-0
No files found.
openai/.env
0 → 100644
View file @
0976d334
OPENAI_API_KEY=ab12
ANTHROPIC_API_KEY=cd34
openai/main.py
0 → 100644
View file @
0976d334
import
os
from
dotenv
import
load_dotenv
import
openai
import
anthropic
# Load API keys
load_dotenv
()
openai
.
api_key
=
os
.
getenv
(
"OPENAI_API_KEY"
)
claude_client
=
anthropic
.
Anthropic
(
api_key
=
os
.
getenv
(
"ANTHROPIC_API_KEY"
))
# Step 1: Claude does the topic research
def
research_with_claude
(
topic
:
str
)
->
str
:
print
(
f
"🔍 Researching topic: {topic}"
)
response
=
claude_client
.
messages
.
create
(
model
=
"claude-3-sonnet-20240229"
,
max_tokens
=
1024
,
temperature
=
0.5
,
messages
=
[
{
"role"
:
"user"
,
"content"
:
f
"Conduct detailed research on: {topic}. Include facts, trends, and examples."
}
]
)
return
response
.
content
[
0
]
.
text
# Step 2: OpenAI summarizes the research
def
summarize_with_openai
(
content
:
str
)
->
str
:
print
(
"📝 Generating summary..."
)
response
=
openai
.
ChatCompletion
.
create
(
model
=
"gpt-4"
,
messages
=
[
{
"role"
:
"system"
,
"content"
:
"You are a summarizer assistant."
},
{
"role"
:
"user"
,
"content"
:
f
"Summarize the following content:
\n\n
{content}"
}
],
temperature
=
0.7
,
max_tokens
=
300
)
return
response
[
"choices"
][
0
][
"message"
][
"content"
]
# Main function
if
__name__
==
"__main__"
:
topic
=
input
(
"Enter a topic for research: "
)
research_text
=
research_with_claude
(
topic
)
print
(
"
\n
📚 Research Output:
\n
"
,
research_text
)
summary
=
summarize_with_openai
(
research_text
)
print
(
"
\n
📌 Summary:
\n
"
,
summary
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment