Fabric icon indicating copy to clipboard operation
Fabric copied to clipboard

Update README.md for #324

Open surak opened this issue 1 year ago • 7 comments

What this Pull Request (PR) does

It's just an update to README, showing how to point to your own server.

Related issues

Closes #324 , showing how to connect to another server

surak avatar Apr 05 '24 10:04 surak

This doesn't currently work with the current code, till #334 is merged. This is because the way the OpenAi() client is instantiated we don't pass the base URL.

ksylvan avatar Apr 10 '24 04:04 ksylvan

Does this mean this works with Groq as well. (https://console.groq.com/docs/openai)

scaruslooner avatar Apr 22 '24 04:04 scaruslooner

Does this mean this works with Groq as well. (https://console.groq.com/docs/openai)

@scaruslooner I don't see why it would not. You'd just need to know the URL for the Groq API.

ksylvan avatar Apr 22 '24 20:04 ksylvan

@danielmiessler @xssdoctor can we get this simple documentation change into the repo?

ksylvan avatar Apr 22 '24 20:04 ksylvan

how do you change the url on windows. I tried using set OPENAI_API_BASE_URL=https://api.groq.com/openai/v1. But got an error:

(fabric) C:\Users\camer\Documents\fabric>set OPENAI_API_BASE_URL=https://api.groq.com/openai/v1 (fabric) C:\Users\camer\Documents\fabric> (fabric) C:\Users\camer\Documents\fabric>fabric --pattern summarize Error: Client error '401 Unauthorized' for url 'https://api.openai.com/v1/models' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401

scaruslooner avatar Apr 22 '24 20:04 scaruslooner

You need to also set OPENAI_API_KEY to your Groq API key otherwise it will try to use your OpenAI API key from your .env file.

On Mac, I did this to run the one command with modified environment. My Groq API key was set in $groq_api

% env OPENAI_BASE_URL=https://api.groq.com/openai/v1 OPENAI_API_KEY=$groq_api fabric --pattern ai -m Llama2-70b-4096 --text 'Discuss the historical significance of the Silk Road in global trade.'
The Silk Road, a network of ancient trade routes connecting China and the Far East with the Middle East and Europe, was established during the Han dynasty (206 BCE - 220 CE) and remained an important conduit for global trade until the 15th century. The Silk Road was historically significant for several reasons:
[...]

PowerShell example:

PS C:\Users\kayvan> $env:OPENAI_BASE_URL = "https://api.groq.com/openai/v1"
PS C:\Users\kayvan> $env:OPENAI_API_KEY="gsk_REDACTED"
PS C:\Users\kayvan> fabric --pattern ai -m Llama2-70b-4096 --text 'Discuss the historical significance of the Silk Road in global trade.'
The Silk Road, a network of ancient trade routes connecting China and the Far East with the Middle East and Europe, was established during the Han dynasty (206 BCE - 220 CE) and remained an important conduit for global trade until the 15th century. The Silk Road was historically significant for several reasons:
1. Facilitated the exchange of goods: The Silk Road facilitated the exchange of goods such as silk, spices, tea, precious stones, and metals between the East and the West.
[...]

On CMD shell, you can do this:

C:\Users\kayvan>set OPENAI_API_KEY=gsk_REDACTED
C:\Users\kayvan>set OPENAI_BASE_URL=https://api.groq.com/openai/v1
C:\Users\kayvan>fabric --pattern ai -m Llama2-70b-4096 --text "Discuss the historical significance of the Silk Road in global trade."
The Silk Road, a network of ancient trade routes connecting China and the Far East with the Middle East and Europe, was established during the Han dynasty (206 BCE - 220 CE) and remained an important conduit for global trade until the 15th century. The Silk Road was historically significant for several reasons:
1. Facilitated the exchange of goods: The Silk Road facilitated the exchange of goods such as silk, spices, tea, precious stones, and metals between the East and the West.
[...]

ksylvan avatar Apr 22 '24 21:04 ksylvan

Thank you so much :) This work!

scaruslooner avatar Apr 22 '24 22:04 scaruslooner