Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ wheels/

# MacOS stuff
.DS_Store

playground.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep a little playground around on SDKs.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ Which prints:
{
"name": "HISTORY",
"url": "https://www.history.com/topics/us-presidents/abraham-lincoln",
"snippet": "Abraham Lincoln - Facts & Summary - HISTORY ..."
"snippet": "Abraham Lincoln - Facts & Summary - HISTORY ...",
"favicon": "https://www.history.com/favicon.ico",
},
...
]
Expand Down Expand Up @@ -195,6 +196,7 @@ Which prints:
"name": "HISTORY",
"url": "https://www.history.com/topics/us-presidents/abraham-lincoln",
"snippet": "Abraham Lincoln - Facts & Summary - HISTORY ..."
"favicon": "https://www.history.com/favicon.ico",
},
...
]
Expand Down
4 changes: 4 additions & 0 deletions src/linkup/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ class LinkupSearchTextResult(BaseModel):
name: The name of the search result.
url: The URL of the search result.
content: The text of the search result.
favicon: The favicon URL of the search result, if available.
"""

type: Literal["text"]
name: str
url: str
content: str
favicon: str = ""


class LinkupSearchImageResult(BaseModel):
Expand Down Expand Up @@ -54,11 +56,13 @@ class LinkupSource(BaseModel):
name: The name of the source.
url: The URL of the source.
snippet: The text excerpt supporting the Linkup answer. Can be empty for image sources.
favicon: The favicon URL of the source, if available.
"""

name: str
url: str
snippet: str = ""
favicon: str = ""


class LinkupSourcedAnswer(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class Company(BaseModel):
"type": "text",
"name": "foo",
"url": "https://foo.com",
"content": "lorem ipsum dolor sit amet"
"content": "lorem ipsum dolor sit amet",
"favicon": "https://foo.com/favicon.ico"
},
{"type": "image", "name": "bar", "url": "https://bar.com"}
]
Expand All @@ -57,6 +58,7 @@ class Company(BaseModel):
name="foo",
url="https://foo.com",
content="lorem ipsum dolor sit amet",
favicon="https://foo.com/favicon.ico",
),
LinkupSearchImageResult(
type="image",
Expand Down