Skip to content

Commit

Permalink
add upload section to chatbots docs
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jun 14, 2024
1 parent b7f26d5 commit ef34cff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/hal9/filetotext.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def extract_from_url(message):
temp_file.write(response.read())
temp_file_path = temp_file.name

import textract
text = textract.process(temp_file_path).decode("utf-8")
os.remove(temp_file_path)
return text
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hal9"
version = "2.3.0"
version = "2.3.1"
description = ""
authors = ["Javier Luraschi <[email protected]>"]
readme = "README.md"
Expand Down
13 changes: 13 additions & 0 deletions website/learn/genapps/apps/chatbots.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,16 @@ for i in range(1, 11):
```

These concepts will prove useful to build our first generative charbot in the [LLM Apps](../llmapps/intro.md) section.

## URLs

Hal9 encourages uploads and links to be processed as URLs. For example, user can reference or upload a PDF as 'https://www.clickdimensions.com/links/TestPDFfile.pdf' which can be read from `input`.

To help assist with processing references, Hal9 provides an `input` function which extracts the text contents of a URL directly as text to easily support managing uploads.

```python
import hal9 as h9

contents = h9.input('Enter a URL: ')
print(f"Contents: {contents}")
```

0 comments on commit ef34cff

Please sign in to comment.