4 ms·
I was skeptical when I noticed the file size for Mac (18.6MB), but it downloads the model during installation (2.5 GB). Text generation wise, it works pretty w
by Oras 4y ago
I was skeptical when I noticed the file size for Mac (18.6MB), but it downloads the model during installation (2.5 GB).
Text generation wise, it works pretty well. The text is not as fast as GPT3.5 or even GPT4. I noticed it is a lot slower when generating code.
I asked it to write a code to search Google and return the first 10 links.
Here is the conversation:
Prompt: Write a python code to search Google and return the links for the first 10 results
Response: Here is the python code to search Google and return the links for the first 10 results:
```python
import requests
import re
url = 'https://www.google.com/search https://www.google.com/search'
# set the number of results to display
num_results = 10
# set the search query
query = 'python'
# make the request to Google
response = requests.get(url)
# extract the links from the response
links = response.text.split('\n')
# extract the links from the response and sort them in descending order
sorted_links = [link.split('\n')[0] for link in links[::-1]]
# print the first 10 links
print(sorted_links[:num_results])
```
Prompt: Rewrite the same code in javascript
Response: Here is the rewritten javascript code to search Google and return the links for the first 10 results:
```javascript
function searchGoogle() {
var query = 'python';
var num_results = 10;
var url = 'https://www.google.com/search'; https://www.google.com/search';
var response = '';
var links = '';
// make the request to Google
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function() {
if (xhr.status === 200) {
response = xhr.responseText;
links = response.split('\n');
links.sort();
links.forEach(function(link) {
links.push(link.split('\n')[0]);
});
console.log(links[:num_results]);
}
};
xhr.send();
}
```
The code above uses XMLHttpRequest to make a request to Google's search engine and extract the links for the first 10 results. The links are then sorted in descending order and printed to the console.
edit: formatting
- metalrain 4y agoUnfortunately it mixes up python and javascript syntax and produces code that doesn't actually run. But I guess A for effort.
- j45 4y agoMinus code generation, I’d be curious to see how the text generation is. GPT also excels at translation
- Kwpolska 4y agoThe query variable isn't actually used anywhere, the code assumes Google returns plaintext links one per line, and it has a weird no-op in the list comprehension. Quite bad if you ask me.