8 changed files with 276 additions and 5 deletions
@ -0,0 +1,63 @@
|
||||
import ollama |
||||
import os |
||||
import requests |
||||
|
||||
from bs4 import BeautifulSoup |
||||
from IPython.display import Markdown, display |
||||
|
||||
MODEL = "llama3.2:3b-instruct-q8_0" |
||||
|
||||
messages = [ |
||||
{"role": "user", "content": "Describe some of the business applications of Generative AI"} |
||||
] |
||||
|
||||
# response = ollama.chat(model=MODEL, messages=messages) |
||||
# print(response['message']['content']) |
||||
class Website: |
||||
|
||||
def __init__(self, url): |
||||
""" |
||||
Create this Website object from the given url using the BeautifulSoup library |
||||
""" |
||||
self.url = url |
||||
response = requests.get(url) |
||||
soup = BeautifulSoup(response.content, 'html.parser') |
||||
self.title = soup.title.string if soup.title else "No title found" |
||||
try: |
||||
for irrelevant in soup.body(["script", "style", "img", "input"]): |
||||
irrelevant.decompose() |
||||
except: |
||||
pass |
||||
self.text = soup.body.get_text(separator="\n", strip=True) |
||||
|
||||
system_prompt = "You are an assistant that analyzes the contents of a website \ |
||||
and provides a short summary, ignoring text that might be navigation related. \ |
||||
Respond in markdown." |
||||
|
||||
def user_prompt_for(website): |
||||
user_prompt = f"You are looking at a website titled {website.title}" |
||||
user_prompt += "\nThe contents of this website is as follows; \ |
||||
please provide a short summary of this website in markdown. \ |
||||
If it includes news or announcements, then summarize these too.\n\n" |
||||
user_prompt += website.text |
||||
return user_prompt |
||||
|
||||
def messages_for(website): |
||||
return [ |
||||
{"role": "system", "content": system_prompt}, |
||||
{"role": "user", "content": user_prompt_for(website)} |
||||
] |
||||
|
||||
def summarize(url): |
||||
website = Website(url) |
||||
response = ollama.chat( |
||||
model = MODEL, |
||||
messages = messages_for(website) |
||||
) |
||||
return response['message']['content'] |
||||
|
||||
def display_summary(url): |
||||
summary = summarize(url) |
||||
print(summary) |
||||
|
||||
display_summary("https://mike-tupper.com/") |
@ -0,0 +1,42 @@
|
||||
This appears to be a press release archive or news feed from Anthropic, a company that specializes in developing large language models and artificial intelligence. Here's a summary of the key points: |
||||
|
||||
**Company Overview** |
||||
|
||||
* Anthropic is a leader in developing AI models that can understand and generate human-like language. |
||||
* The company has developed several AI models, including Claude, which is a conversational AI model designed to assist with various tasks. |
||||
|
||||
**Product Updates** |
||||
|
||||
* Claude: A conversational AI model that can be used for a variety of tasks, including customer service, data enrichment, and more. New versions of Claude have been released regularly, including: |
||||
+ Claude 2 (available on Amazon Bedrock) |
||||
+ Claude 3 (features improved performance and new capabilities) |
||||
+ Claude 3 Haiku (a faster version of Claude 3) |
||||
+ Claude Pro (an enterprise-level version of Claude) |
||||
|
||||
**Partnerships and Collaborations** |
||||
|
||||
* Anthropic has partnered with several companies, including: |
||||
+ Amazon Web Services (AWS) to integrate Claude into AWS's services |
||||
+ Accenture to develop trusted solutions for enterprises |
||||
+ BCG (Boston Consulting Group) to expand access to safer AI |
||||
+ SKT (Samsung Electronics) on a partnership announcement |
||||
|
||||
**Industry Recognition** |
||||
|
||||
* Anthropic has received recognition from industry leaders and experts, including: |
||||
+ Dario Amodei's prepared remarks from the AI Safety Summit on Anthropic's Responsible Scaling Policy |
||||
+ Thoughts on the US Executive Order, G7 Code of Conduct, and Bletchley Park Summit by Anthropic |
||||
|
||||
**Safety and Ethics** |
||||
|
||||
* Anthropic has emphasized its commitment to safety and ethics in AI development, including: |
||||
+ Expanding access to safer AI with Amazon |
||||
+ Releasing a Responsible Scaling Policy |
||||
+ Aligning on child safety principles |
||||
|
||||
**Other News** |
||||
|
||||
* Anthropic has also made headlines for other reasons, such as: |
||||
+ Introducing Claude Android app |
||||
+ Fine-tuning Claude 3 Haiku in Amazon Bedrock |
||||
+ Evaluating prompts in the developer console |
@ -0,0 +1,32 @@
|
||||
Based on the provided webpage contents, here is a summary of the information: |
||||
|
||||
**About Anthropic** |
||||
|
||||
* Anthropic is a company that develops large-scale AI systems. |
||||
* Their research teams aim to create safer, steerable, and more reliable models. |
||||
|
||||
**Careers** |
||||
|
||||
* Anthropic has a careers page that lists open roles across various teams and offices. |
||||
* The company values direct evidence of ability, such as independent research, blog posts, or open-source software contributions. |
||||
* They do not require PhDs, degrees, or previous ML experience for technical staff positions. |
||||
* About half of the technical staff have a PhD, and about half had prior experience in ML. |
||||
* Anthropic sponsors visas and green cards for eligible candidates. |
||||
|
||||
**Interview Process** |
||||
|
||||
* Interviews are conducted over Google Meet, with a preference for PST office hours. |
||||
* Candidates can re-apply after 12 months if they are not successful initially. |
||||
* The company does not provide feedback on resumes or interviews. |
||||
|
||||
**Remote Work** |
||||
|
||||
* Anthropic staff typically come to the office regularly, but some may work remotely part-time or full-time. |
||||
* The company understands that moving can take time and offers a transitional phase for remote workers. |
||||
|
||||
**Research** |
||||
|
||||
* Anthropic's research teams focus on developing safer, steerable, and more reliable large-scale AI systems. |
||||
* The company is working at the frontier of AI research and development. |
||||
|
||||
Overall, Anthropic appears to be a company that values innovation, expertise, and diversity in its workforce. They prioritize creating safe and reliable AI systems and offer opportunities for career growth and development. |
@ -0,0 +1,134 @@
|
||||
import ollama |
||||
import os |
||||
import requests |
||||
import json |
||||
|
||||
from bs4 import BeautifulSoup |
||||
from IPython.display import Markdown, display |
||||
|
||||
""" |
||||
Available Models: |
||||
llama3.3:latest a6eb4748fd29 42 GB 24 hours ago |
||||
granite3-moe:3b 157f538ae66e 2.1 GB 2 weeks ago |
||||
granite3-dense:8b 199456d876ee 4.9 GB 2 weeks ago |
||||
nemotron:70b-instruct-q5_K_M def2cefbe818 49 GB 6 weeks ago |
||||
llama3.2:3b-instruct-q8_0 e410b836fe61 3.4 GB 7 weeks ago |
||||
llama3.2:latest a80c4f17acd5 2.0 GB 2 months ago |
||||
reflection:latest 5084e77c1e10 39 GB 3 months ago |
||||
HammerAI/llama-3.1-storm:latest 876631929cf6 8.5 GB 3 months ago |
||||
granite-code:34b 4ce00960ca84 19 GB 3 months ago |
||||
llama3.1:8b 91ab477bec9d 4.7 GB 3 months ago |
||||
llama3.1-Q8-8b:latest 3d41179680d6 8.5 GB 3 months ago |
||||
nomic-embed-text:latest 0a109f422b47 274 MB 3 months ago |
||||
rjmalagon/gte-qwen2-7b-instruct-embed-f16:latest a94ce5b37c1c 15 GB 3 months ago |
||||
llama3:70b-instruct-q5_K_M 4e84a5514862 49 GB 3 months ago |
||||
llama3:8b 365c0bd3c000 4.7 GB 3 months ago |
||||
mistral-nemo:12b-instruct-2407-q8_0 b91eec34730f 13 GB 3 months ago |
||||
""" |
||||
|
||||
MODEL = "llama3.3" |
||||
|
||||
messages = [ |
||||
{"role": "user", "content": "Describe some of the business applications of Generative AI"} |
||||
] |
||||
|
||||
# response = ollama.chat(model=MODEL, messages=messages) |
||||
# print(response['message']['content']) |
||||
class Website: |
||||
""" |
||||
A utility class to represent a website that we have scraped, now with links |
||||
""" |
||||
url: str |
||||
title: str |
||||
body: str |
||||
links: list[str] |
||||
text: str |
||||
|
||||
def __init__(self, url): |
||||
self.url = url |
||||
response = requests.get(url) |
||||
self.body = response.content |
||||
soup = BeautifulSoup(self.body, 'html.parser') |
||||
self.title = soup.title.string if soup.title else "No title found" |
||||
if soup.body: |
||||
try: |
||||
for irrelevant in soup.body(["script", "style", "img", "input"]): |
||||
irrelevant.decompose() |
||||
self.text = soup.body.get_text(separator="\n", strip=True) |
||||
except: |
||||
pass |
||||
else: |
||||
self.text = "" |
||||
links = [link.get('href') for link in soup.find_all('a')] |
||||
self.links = [link for link in links if link] |
||||
|
||||
def get_contents(self): |
||||
return f"Webpage Title:\n{self.title}\nWebpage Contents:\n{self.text}\n\n" |
||||
|
||||
link_system_prompt = "You are provided with a list of links found on a webpage. \ |
||||
You are able to decide which of the links would be most relevant to include in a brochure about the company, \ |
||||
such as links to an About page, or a Company page, or Careers/Jobs pages.\n" |
||||
link_system_prompt += "You should respond in JSON as in this example:" |
||||
link_system_prompt += """ |
||||
{ |
||||
"links": [ |
||||
{"type": "about page", "url": "https://full.url/goes/here/about"}, |
||||
{"type": "careers page": "url": "https://another.full.url/careers"} |
||||
] |
||||
} |
||||
""" |
||||
|
||||
def get_links_user_prompt(website): |
||||
user_prompt = f"Here is the list of links on the website of {website.url} - " |
||||
user_prompt += "please decide which of these are relevant web links for a brochure about the company, respond with the full https URL in JSON format. \ |
||||
Do not include Terms of Service, Privacy, email links.\n" |
||||
user_prompt += "Links (some might be relative links):\n" |
||||
user_prompt += "\n".join(website.links) |
||||
return user_prompt |
||||
|
||||
def get_links(url): |
||||
website = Website(url) |
||||
response = ollama.chat( |
||||
model=MODEL, |
||||
messages=[ |
||||
{"role": "system", "content": link_system_prompt}, |
||||
{"role": "user", "content": get_links_user_prompt(website)} |
||||
], |
||||
format="json" |
||||
) |
||||
result = response['message']['content'] |
||||
return json.loads(result) |
||||
|
||||
def get_all_details(url): |
||||
result = "Landing page:\n" |
||||
result += Website(url).get_contents() |
||||
links = get_links(url) |
||||
# print("Found links:", links) |
||||
for link in links["links"]: |
||||
result += f"\n\n{link['type']}\n" |
||||
result += Website(link["url"]).get_contents() |
||||
return result |
||||
|
||||
system_prompt = "You are an assistant that analyzes the contents of several relevant pages from a company website \ |
||||
and creates a short professional sales brochure about the company for prospective customers, investors and recruits. Respond \ |
||||
in markdown. Include details of company culture, customers and careers/jobs if you have the information." |
||||
|
||||
def get_brochure_user_prompt(company_name, url): |
||||
user_prompt = f"You are looking at a company called: {company_name}\n" |
||||
user_prompt += f"Here are the contents of its landing page and other relevant pages; use this information to build a short brochure of the company in markdown.\n" |
||||
user_prompt += get_all_details(url) |
||||
user_prompt = user_prompt[:20000] # Truncate if more than 5,000 characters |
||||
return user_prompt |
||||
|
||||
def create_brochure(company_name, url): |
||||
response = ollama.chat( |
||||
model=MODEL, |
||||
messages=[ |
||||
{"role": "system", "content": system_prompt}, |
||||
{"role": "user", "content": get_brochure_user_prompt(company_name, url)} |
||||
], |
||||
) |
||||
result = response['message']['content'] |
||||
print(result) |
||||
|
||||
create_brochure("Anthropic", "https://anthropic.com") |
Loading…
Reference in new issue