Post AcmF5L2TzBPfUmGqe0 by llimllib@hachyderm.io
(DIR) More posts by llimllib@hachyderm.io
(DIR) Post #Acm9QkSo3NiyhkPRK4 by simon@fedi.simonwillison.net
2023-12-13T18:52:26Z
0 likes, 0 repeats
Figured out how to use Google's Gemini Pro model using curl:curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$API_KEY" \ -H 'Content-Type: application/json' \ -X POST \ -d '{"contents": [{"parts":[{"text": "A joke about a pelican"}]}]}' \ | jq '.candidates[0].content.parts[0].text'
(DIR) Post #AcmA3Ox7xrdjHd1UES by simon@fedi.simonwillison.net
2023-12-13T18:56:28Z
0 likes, 0 repeats
I tend to prefer using the HTTP API directly over the official client library, because in my experience official client libraries (at least in the AI space) have a nasty tendency to ship breaking changes every few months
(DIR) Post #AcmAH96pfPe8CS7Ge8 by simon@fedi.simonwillison.net
2023-12-13T18:57:28Z
0 likes, 0 repeats
Relevant API documentation: https://ai.google.dev/tutorials/rest_quickstart
(DIR) Post #AcmASjMxC3AHqNBHSS by mistersql@mastodon.social
2023-12-13T18:59:09Z
0 likes, 0 repeats
@simon Well, can it tell a funny joke?
(DIR) Post #AcmF5L2TzBPfUmGqe0 by llimllib@hachyderm.io
2023-12-13T19:55:54Z
0 likes, 0 repeats
@simon I don't know if they stream responses, but I used curl's `--nobuffer` and jq's `--unbuffered` to stream to the console with openai's API, it gives a lot better feel to the UI if available.https://github.com/llimllib/gpt-bash-cli/blob/587b790d90b671876a8d9d08848c2370e87dd84b/gpt#L180-L188
(DIR) Post #AcmG9xCY8nRIxykCiu by ericflo@mastodon.xyz
2023-12-13T20:07:51Z
0 likes, 0 repeats
@simon Agree! Also much easier to reason about when you remove a layer of indirection
(DIR) Post #AcmHcJ44XzGipvrXGK by icing@chaos.social
2023-12-13T20:23:59Z
0 likes, 0 repeats
@simon you may leave out the `-X POST`, the POST method is triggered by the `-d data` already.
(DIR) Post #AcmIFUAnBEugaAghSy by simon@fedi.simonwillison.net
2023-12-13T20:31:19Z
0 likes, 0 repeats
Turned this into a new LLM plugin - you can now "llm install gemini", then "llm keys set gemini" to set an API key, then "llm -m gemini-pro 'prompt goes here'"https://github.com/simonw/llm-gemini
(DIR) Post #AcmJ1jpIHjVj1vdmLo by simon@fedi.simonwillison.net
2023-12-13T20:35:18Z
0 likes, 0 repeats
@mistersql Maybe 1/10 didn't suck, which isn't too bad for an LLM!
(DIR) Post #Acmirss0P4bszVs2xE by ahyatt@urbanists.social
2023-12-14T01:29:39Z
0 likes, 0 repeats
@simon According to the press release, you can also get embeddings, but I don't see any new APIs. Have you found anything out? Also, gotta say I'm super happy that they did not re-use their old Vertex APIs, the streaming REST API was especially bizarre.
(DIR) Post #AcmxUqTUdr4aDKsTho by simon@fedi.simonwillison.net
2023-12-14T04:13:32Z
0 likes, 0 repeats
@ahyatt looks like this is their embeddings documentation https://ai.google.dev/tutorials/rest_quickstart#embedding
(DIR) Post #Acn5bC12GUiYOR6XUu by ahyatt@urbanists.social
2023-12-14T05:44:12Z
0 likes, 0 repeats
@simon Thank you for finding that! But that's very different than the other API they documented, with a completely different endpoint. https://cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/quickstart-multimodal is the one I've been looking at (which doesn't seem to have embeddings). Do they really have two different APIs, one for Cloud Vertex and one for API Studio? The API Studio is much easier though, so maybe best to switch to that.
(DIR) Post #AcnAtVhiIoRORGcXVA by simon@fedi.simonwillison.net
2023-12-14T06:43:51Z
0 likes, 0 repeats
@ahyatt I haven't even tried to figure out what the difference between Veryex AI and whatever I'm using is