-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from dcSpark/refactor-youtube-summary
Refactor youtube summary & imap/smtp ssl flag
- Loading branch information
Showing
10 changed files
with
175 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import asyncio | ||
from tool import run, CONFIG, INPUTS | ||
# Assuming the classes and functions are imported from your module | ||
# from your_module import CONFIG, INPUTS, run | ||
|
||
async def test_imap_connection(): | ||
# Create a CONFIG instance with fake credentials | ||
config = CONFIG() | ||
config.imap_server = "server.fakemail.com" # Replace with a valid IMAP server for testing | ||
config.username = "shinkai.dev@fakemail.com" # Fake username | ||
config.password = "fakepassword" # Fake password | ||
config.port = 993 # Common port for IMAPS | ||
config.ssl = True # Use SSL | ||
|
||
# Create an INPUTS instance | ||
inputs = INPUTS() | ||
inputs.from_date = None # Optional: set to a date string if needed | ||
inputs.to_date = None # Optional: set to a date string if needed | ||
|
||
# Run the function and capture the output | ||
output = await run(config, inputs) | ||
print("Hello World") | ||
# Print the output | ||
print("Login Status:", output.login_status) | ||
print("Emails Retrieved:", len(output.emails)) | ||
for email in output.emails: | ||
print(email['subject'] + " " + email['sender'] + " " + str(email['date'])) | ||
|
||
# Run the test | ||
if __name__ == "__main__": | ||
asyncio.run(test_imap_connection()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import asyncio | ||
from tool import CONFIG, INPUTS, run # Adjust the import based on your module structure | ||
|
||
async def test_email_sender(): | ||
# Create a CONFIG instance with fake credentials | ||
config = CONFIG() | ||
config.smtp_server = "smtp.fakeemail.com" # Replace with a valid SMTP server for testing | ||
config.port = 465 # Common port for SMTP with STARTTLS | ||
config.sender_email = "shinkai.dev@fakeemail.com" # Fake sender email | ||
config.sender_password = "fakepassword" # Fake password | ||
config.ssl = True # Set to True if you want to test SSL | ||
|
||
# Create an INPUTS instance | ||
inputs = INPUTS() | ||
inputs.recipient_email = "eduardo@fakeemail.com" # Fake recipient email | ||
inputs.subject = "Test Email" | ||
inputs.body = "This is a test email sent using fake credentials." | ||
|
||
# Run the function and capture the output | ||
output = await run(config, inputs) | ||
|
||
# Print the output | ||
print("Email Sending Status:", output.status) | ||
print("Message:", output.message) | ||
|
||
# Run the test | ||
if __name__ == "__main__": | ||
asyncio.run(test_email_sender()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,53 @@ | ||
{ | ||
"id": "youtube-summary", | ||
"name": "YouTube Video Summary", | ||
"description": "Summarizes a YouTube video. Provides a summary with organized sections and clickable timestamp links. Useful for quickly grasping main points, preparing for discussions, or efficient research. Example uses: summarizing tech talks, product reviews, or educational lectures. Parameters: url (string) - The full YouTube video URL to process.", | ||
"author": "Shinkai", | ||
"keywords": [ | ||
"youtube", | ||
"transcript", | ||
"video", | ||
"summary", | ||
"sections", | ||
"timestamp", | ||
"links" | ||
], | ||
"configurations": { | ||
"type": "object", | ||
"properties": { | ||
"apiUrl": { | ||
"type": "string", | ||
"description": "The URL of the OpenAI compatible API endpoint for summary generation. Optional. Default: \"http://127.0.0.1:11435\".", | ||
"nullable": true, | ||
"example": "https://api.openai.com/v1" | ||
}, | ||
"apiKey": { | ||
"type": "string", | ||
"description": "The API key for the OpenAI compatible endpoint. Required if using a service that needs authentication.", | ||
"nullable": true, | ||
"example": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | ||
}, | ||
"model": { | ||
"type": "string", | ||
"description": "The name of the language model for summary generation. Optional. Default: \"llama3.1:8b-instruct-q4_1\".", | ||
"nullable": true, | ||
"example": "gpt-3.5-turbo" | ||
} | ||
"id": "youtube-summary", | ||
"name": "Youtube Transcript Summarizer", | ||
"description": "Fetches the transcript of a YouTube video and generates a formatted summary using an LLM.", | ||
"author": "@@eduardosotomontaner.arb-sep-shinkai", | ||
"version": "1.0.0", | ||
"keywords": [ | ||
"youtube", | ||
"transcript", | ||
"summary", | ||
"video", | ||
"LLM" | ||
], | ||
"configurations": { | ||
"type": "object", | ||
"properties": {}, | ||
"required": [] | ||
}, | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"url": { | ||
"type": "string", | ||
"description": "The URL of the YouTube video" | ||
}, | ||
"required": [] | ||
"lang": { | ||
"type": "string", | ||
"description": "The language for the transcript (optional)" | ||
} | ||
}, | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"url": { | ||
"type": "string", | ||
"description": "The full URL of the YouTube video to transcribe and summarize. Must be a valid and accessible YouTube video link.", | ||
"example": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" | ||
}, | ||
"lang": { | ||
"type": "string", | ||
"description": "The language code for the transcript in ISO 639-1 format (e.g. \"en\" for English). Optional. If not specified, will use the default available transcript.", | ||
"example": "en", | ||
"nullable": true | ||
} | ||
}, | ||
"required": [ | ||
"url" | ||
] | ||
"required": [ | ||
"url" | ||
] | ||
}, | ||
"result": { | ||
"type": "object", | ||
"properties": { | ||
"summary": { | ||
"type": "string", | ||
"description": "The generated summary of the video" | ||
} | ||
}, | ||
"result": { | ||
"type": "object", | ||
"properties": { | ||
"summary": { | ||
"type": "string", | ||
"description": "A markdown-formatted summary of the video content, divided into sections with timestamp links to relevant parts of the video." | ||
} | ||
}, | ||
"required": [ | ||
"summary" | ||
] | ||
} | ||
} | ||
"required": [ | ||
"summary" | ||
] | ||
}, | ||
"sqlTables": [], | ||
"sqlQueries": [], | ||
"tools": [ | ||
"local:::rust_toolkit:::shinkai_llm_prompt_processor" | ||
], | ||
"oauth": [] | ||
} |
Oops, something went wrong.