Open kun432 opened 1 day ago
Hi @kun432! You've discovered a documentation error! At some point the environment variable name for the OpenAI API key got changed to OPENAI_TOKEN
. If you scroll down to the text-completion
and text-completion-rag
container definitions, you can see that's the environment variable that's expected. So, prior to to running TrustGraph, set your API key with:
export OPENAI_TOKEN=<your-api-key-here>
Thanks for pointing out this documentation mistake!
I've updated the Config UIs and documentation to reflect OPENAI_TOKEN
.
0.14.17 release Config UI: https://config-ui.demo.trustgraph.ai/ 0.15.4 pre-release Config UI: https://dev.config-ui.demo.trustgraph.ai/
Version 0.15.4 includes tools for creating a ReAct Agent with multiple tools.
@JackColquitt
as I said earlier,
I set OPENAI_TOKEN too, but not solved.
Tried new config generated by new Config UI(0.14.17), still erorr happens.
seems solved.
I changed docker-compose.yaml like this:
text-completion:
(snip)
environment:
OPENAI_KEY: ${OPENAI_KEY}
(snip)
text-completion-rag:
(snip)
environment:
OPENAI_KEY: ${OPENAI_KEY}
(snip)
$ tg-processor-state
+--------------------------+---------+
| processor | state |
+--------------------------+---------+
| prompt-rag | running |
| chunker | running |
| embeddings | running |
| store-triples | running |
| query-triples | running |
| kg-extract-topics | running |
| vectorize | running |
| kg-extract-definitions | running |
| prompt | running |
| metering-rag | running |
| text-completion-rag | running |
| graph-rag | running |
| metering | running |
| store-graph-embeddings | running |
| kg-extract-relationships | running |
| pdf-decoder | running |
| text-completion | running |
| query-graph-embeddings | running |
+--------------------------+---------+
inside text-completion container:
# grep -3 -i "OPENAI_KEY" /usr/local/lib/python3.12/site-packages/trustgraph/model/text_completion/openai/llm.py
default_model = 'gpt-3.5-turbo'
default_temperature = 0.0
default_max_output = 4096
default_api_key = os.getenv("OPENAI_KEY")
class Processor(ConsumerProducer):
packaging problems?
Ok, so it wasn't a documentation problem after all! As you found, the text-completion
module for OpenAI, https://github.com/trustgraph-ai/trustgraph/blob/release/v0.14/trustgraph-flow/trustgraph/model/text_completion/openai/llm.py, is still looking for the key to be passed as OPENAI_KEY
. It's not a documentation issue, but a templating one. The name got changed to OPENAI_TOKEN
in the Jsonnet templates. We'll make this correction in the next release version. We also probably need to update the default OpenAI model to gpt-4o-mini
, because I believe gpt-3.5-turbo
has been deprecated by now.
Great bug, thanks for raising @kun432
We're gonna change everything to OPENAI_TOKEN. The documentation wins out.
Tried TrustGraph using Docker on Mac based on the config generated by https://config-ui.demo.trustgraph.ai/ but after docker compose up, always see error logs like this:
I followed the procedure on https://config-ui.demo.trustgraph.ai/.
also when docker compose up, some warnings showed up like this:
I set OPENAI_TOKEN too, but not solved.
So, how to set OpenAI API key correctly?
Here's my docker-compose.yaml