trustgraph-ai / trustgraph

Connect Data Silos with Reliable AI⚡🚀
https://trustgraph.ai
GNU Affero General Public License v3.0
167 stars 12 forks source link

How to set OpenAI API key? #160

Open kun432 opened 1 day ago

kun432 commented 1 day ago

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:

text-completion-rag-1       | Exception ignored in: <function BaseProcessor.__del__ at 0x7ffffb8f6840>
text-completion-rag-1       | Traceback (most recent call last):
text-completion-rag-1       |   File "/usr/local/lib/python3.12/site-packages/trustgraph/base/base_processor.py", line 42, in __del__
text-completion-rag-1       |     if self.client:
text-completion-rag-1       |        ^^^^^^^^^^^
text-completion-rag-1       | AttributeError: 'Processor' object has no attribute 'client'
text-completion-rag-1       | <class 'RuntimeError'>
text-completion-rag-1       | Exception: OpenAI API key not specified
text-completion-rag-1       | Will retry...
text-completion-1           | Exception ignored in: <function BaseProcessor.__del__ at 0x7ffffb8f6840>
text-completion-1           | Traceback (most recent call last):
text-completion-1           |   File "/usr/local/lib/python3.12/site-packages/trustgraph/base/base_processor.py", line 42, in __del__
text-completion-1           |     if self.client:
text-completion-1           |        ^^^^^^^^^^^
text-completion-1           | AttributeError: 'Processor' object has no attribute 'client'
text-completion-1           | <class 'RuntimeError'>
text-completion-1           | Exception: OpenAI API key not specified
text-completion-1           | Will retry...

I followed the procedure on https://config-ui.demo.trustgraph.ai/.

export OPENAI_KEY=XXXXXXXXXXXX
unzip deploy.zip -d deploy
cd deploy
docker compose -f docker-compose.yaml up

also when docker compose up, some warnings showed up like this:

WARN[0000] The "OPENAI_TOKEN" variable is not set. Defaulting to a blank string. 
WARN[0000] The "OPENAI_TOKEN" variable is not set. Defaulting to a blank string.

I set OPENAI_TOKEN too, but not solved.

So, how to set OpenAI API key correctly?

Here's my docker-compose.yaml

services:
  chunker:
    command:
    - chunker-recursive
    - -p
    - pulsar://pulsar:6650
    - --chunk-size
    - '1000'
    - --chunk-overlap
    - '200'
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  embeddings:
    command:
    - embeddings-hf
    - -p
    - pulsar://pulsar:6650
    - -m
    - all-MiniLM-L6-v2
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 400M
        reservations:
          cpus: '0.5'
          memory: 400M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  grafana:
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 256M
        reservations:
          cpus: '0.5'
          memory: 256M
    environment:
      GF_ORG_NAME: trustgraph.ai
    image: docker.io/grafana/grafana:11.1.4
    ports:
    - 3000:3000
    restart: on-failure:100
    volumes:
    - grafana-storage:/var/lib/grafana
    - ./grafana/provisioning/:/etc/grafana/provisioning/dashboards/
    - ./grafana/provisioning/:/etc/grafana/provisioning/datasources/
    - ./grafana/dashboards/:/var/lib/grafana/dashboards/
  graph-rag:
    command:
    - graph-rag
    - -p
    - pulsar://pulsar:6650
    - --prompt-request-queue
    - non-persistent://tg/request/prompt-rag
    - --prompt-response-queue
    - non-persistent://tg/response/prompt-rag-response
    - --entity-limit
    - '50'
    - --triple-limit
    - '30'
    - --max-subgraph-size
    - '3000'
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  init-pulsar:
    command:
    - tg-init-pulsar
    - -p
    - http://pulsar:8080
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  kg-extract-definitions:
    command:
    - kg-extract-definitions
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  kg-extract-relationships:
    command:
    - kg-extract-relationships
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  kg-extract-topics:
    command:
    - kg-extract-topics
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  metering:
    command:
    - metering
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  metering-rag:
    command:
    - metering
    - -p
    - pulsar://pulsar:6650
    - -i
    - non-persistent://tg/response/text-completion-rag-response
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  neo4j:
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 768M
        reservations:
          cpus: '0.5'
          memory: 768M
    environment:
      NEO4J_AUTH: neo4j/password
    image: docker.io/neo4j:5.22.0-community-bullseye
    ports:
    - 7474:7474
    - 7687:7687
    restart: on-failure:100
    volumes:
    - neo4j:/data
  pdf-decoder:
    command:
    - pdf-decoder
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  prometheus:
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/prom/prometheus:v2.53.2
    ports:
    - 9090:9090
    restart: on-failure:100
    volumes:
    - ./prometheus:/etc/prometheus/
    - prometheus-data:/prometheus
  prompt:
    command:
    - prompt-template
    - -p
    - pulsar://pulsar:6650
    - --text-completion-request-queue
    - non-persistent://tg/request/text-completion
    - --text-completion-response-queue
    - non-persistent://tg/response/text-completion-response
    - --system-prompt
    - "\u3042\u306A\u305F\u306F\u3001\u89AA\u5207\u306A\u65E5\u672C\u8A9E\u306E\u30A2\
      \u30B7\u30B9\u30BF\u30F3\u30C8\u3067\u3059\u3002\u3042\u306A\u305F\u306E\u4ED5\
      \u4E8B\u306F\u3001NLP\uFF08\u81EA\u7136\u8A00\u8A9E\u51E6\u7406\uFF09\u306E\u30BF\
      \u30B9\u30AF\u3092\u3053\u306A\u3059\u3053\u3068\u3067\u3059\u3002"
    - --prompt
    - 'document-prompt=Study the following context. Use only the information provided
      in the context in your response. Do not speculate if the answer is not found
      in the provided set of knowledge statements.

      Here is the context:

      {{documents}}

      Use only the provided knowledge statements to respond to the following:

      {{query}}

      '
    - 'extract-definitions=<instructions>

      Study the following text and derive definitions for any discovered entities.

      Do not provide definitions for entities whose definitions are incomplete

      or unknown.

      Output relationships in JSON format as an arary of objects with fields:

      - entity: the name of the entity

      - definition: English text which defines the entity

      </instructions>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not use special characters in the abstract text. The

      abstract will be written as plain text.  Do not add markdown formatting

      or headers or prefixes.  Do not include null or unknown definitions.

      </requirements>'
    - 'extract-relationships=<instructions>

      Study the following text and derive entity relationships.  For each

      relationship, derive the subject, predicate and object of the relationship.

      Output relationships in JSON format as an arary of objects with fields:

      - subject: the subject of the relationship

      - predicate: the predicate

      - object: the object of the relationship

      - object-entity: false if the object is a simple data type: name, value or date.  true
      if it is an entity.

      </instructions>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not use special characters in the abstract text. The

      abstract must be written as plain text.  Do not add markdown formatting

      or headers or prefixes.

      </requirements>'
    - 'extract-rows=<instructions>

      Study the following text and derive objects which match the schema provided.

      You must output an array of JSON objects for each object you discover

      which matches the schema.  For each object, output a JSON object whose fields

      carry the name field specified in the schema.

      </instructions>

      <schema>

      {{schema}}

      </schema>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not add markdown formatting or headers or prefixes.

      </requirements>'
    - "extract-topics=You are a helpful assistant that performs information extraction\
      \ tasks for a provided text.\nRead the provided text. You will identify topics\
      \ and their definitions in JSON.\n\nReading Instructions:\n- Ignore document\
      \ formatting in the provided text.\n- Study the provided text carefully.\n\n\
      Here is the text:\n{{text}}\n\nResponse Instructions: \n- Do not respond with\
      \ special characters.\n- Return only topics that are concepts and unique to\
      \ the provided text.\n- Respond only with well-formed JSON.\n- The JSON response\
      \ shall be an array of objects with keys \"topic\" and \"definition\". \n- The\
      \ JSON response shall use the following structure:\n\n```json\n[{\"topic\":\
      \ string, \"definition\": string}]\n```\n\n- Do not write any additional text\
      \ or explanations."
    - 'kg-prompt=Study the following set of knowledge statements. The statements are
      written in Cypher format that has been extracted from a knowledge graph. Use
      only the provided set of knowledge statements in your response. Do not speculate
      if the answer is not found in the provided set of knowledge statements.

      Here''s the knowledge statements:

      {% for edge in knowledge %}({{edge.s}})-[{{edge.p}}]->({{edge.o}})

      {%endfor%}

      Use only the provided knowledge statements to respond to the following:

      {{query}}

      '
    - question={{question}}
    - --prompt-response-type
    - document-prompt=text
    - extract-definitions=json
    - extract-relationships=json
    - extract-rows=json
    - extract-topics=json
    - kg-prompt=text
    - --prompt-schema
    - extract-definitions={"items":{"properties":{"definition":{"type":"string"},"entity":{"type":"string"}},"required":["entity","definition"],"type":"object"},"type":"array"}
    - extract-relationships={"items":{"properties":{"object":{"type":"string"},"object-entity":{"type":"boolean"},"predicate":{"type":"string"},"subject":{"type":"string"}},"required":["subject","predicate","object","object-entity"],"type":"object"},"type":"array"}
    - extract-topics={"items":{"properties":{"definition":{"type":"string"},"topic":{"type":"string"}},"required":["topic","definition"],"type":"object"},"type":"array"}
    - --prompt-term
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  prompt-rag:
    command:
    - prompt-template
    - -p
    - pulsar://pulsar:6650
    - -i
    - non-persistent://tg/request/prompt-rag
    - -o
    - non-persistent://tg/response/prompt-rag-response
    - --text-completion-request-queue
    - non-persistent://tg/request/text-completion-rag
    - --text-completion-response-queue
    - non-persistent://tg/response/text-completion-rag-response
    - --system-prompt
    - "\u3042\u306A\u305F\u306F\u3001\u89AA\u5207\u306A\u65E5\u672C\u8A9E\u306E\u30A2\
      \u30B7\u30B9\u30BF\u30F3\u30C8\u3067\u3059\u3002\u3042\u306A\u305F\u306E\u4ED5\
      \u4E8B\u306F\u3001NLP\uFF08\u81EA\u7136\u8A00\u8A9E\u51E6\u7406\uFF09\u306E\u30BF\
      \u30B9\u30AF\u3092\u3053\u306A\u3059\u3053\u3068\u3067\u3059\u3002"
    - --prompt
    - 'document-prompt=Study the following context. Use only the information provided
      in the context in your response. Do not speculate if the answer is not found
      in the provided set of knowledge statements.

      Here is the context:

      {{documents}}

      Use only the provided knowledge statements to respond to the following:

      {{query}}

      '
    - 'extract-definitions=<instructions>

      Study the following text and derive definitions for any discovered entities.

      Do not provide definitions for entities whose definitions are incomplete

      or unknown.

      Output relationships in JSON format as an arary of objects with fields:

      - entity: the name of the entity

      - definition: English text which defines the entity

      </instructions>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not use special characters in the abstract text. The

      abstract will be written as plain text.  Do not add markdown formatting

      or headers or prefixes.  Do not include null or unknown definitions.

      </requirements>'
    - 'extract-relationships=<instructions>

      Study the following text and derive entity relationships.  For each

      relationship, derive the subject, predicate and object of the relationship.

      Output relationships in JSON format as an arary of objects with fields:

      - subject: the subject of the relationship

      - predicate: the predicate

      - object: the object of the relationship

      - object-entity: false if the object is a simple data type: name, value or date.  true
      if it is an entity.

      </instructions>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not use special characters in the abstract text. The

      abstract must be written as plain text.  Do not add markdown formatting

      or headers or prefixes.

      </requirements>'
    - 'extract-rows=<instructions>

      Study the following text and derive objects which match the schema provided.

      You must output an array of JSON objects for each object you discover

      which matches the schema.  For each object, output a JSON object whose fields

      carry the name field specified in the schema.

      </instructions>

      <schema>

      {{schema}}

      </schema>

      <text>

      {{text}}

      </text>

      <requirements>

      You will respond only with raw JSON format data. Do not provide

      explanations. Do not add markdown formatting or headers or prefixes.

      </requirements>'
    - "extract-topics=You are a helpful assistant that performs information extraction\
      \ tasks for a provided text.\nRead the provided text. You will identify topics\
      \ and their definitions in JSON.\n\nReading Instructions:\n- Ignore document\
      \ formatting in the provided text.\n- Study the provided text carefully.\n\n\
      Here is the text:\n{{text}}\n\nResponse Instructions: \n- Do not respond with\
      \ special characters.\n- Return only topics that are concepts and unique to\
      \ the provided text.\n- Respond only with well-formed JSON.\n- The JSON response\
      \ shall be an array of objects with keys \"topic\" and \"definition\". \n- The\
      \ JSON response shall use the following structure:\n\n```json\n[{\"topic\":\
      \ string, \"definition\": string}]\n```\n\n- Do not write any additional text\
      \ or explanations."
    - 'kg-prompt=Study the following set of knowledge statements. The statements are
      written in Cypher format that has been extracted from a knowledge graph. Use
      only the provided set of knowledge statements in your response. Do not speculate
      if the answer is not found in the provided set of knowledge statements.

      Here''s the knowledge statements:

      {% for edge in knowledge %}({{edge.s}})-[{{edge.p}}]->({{edge.o}})

      {%endfor%}

      Use only the provided knowledge statements to respond to the following:

      {{query}}

      '
    - question={{question}}
    - --prompt-response-type
    - document-prompt=text
    - extract-definitions=json
    - extract-relationships=json
    - extract-rows=json
    - extract-topics=json
    - kg-prompt=text
    - --prompt-schema
    - extract-definitions={"items":{"properties":{"definition":{"type":"string"},"entity":{"type":"string"}},"required":["entity","definition"],"type":"object"},"type":"array"}
    - extract-relationships={"items":{"properties":{"object":{"type":"string"},"object-entity":{"type":"boolean"},"predicate":{"type":"string"},"subject":{"type":"string"}},"required":["subject","predicate","object","object-entity"],"type":"object"},"type":"array"}
    - extract-topics={"items":{"properties":{"definition":{"type":"string"},"topic":{"type":"string"}},"required":["topic","definition"],"type":"object"},"type":"array"}
    - --prompt-term
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  pulsar:
    command:
    - bin/pulsar
    - standalone
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 1500M
        reservations:
          cpus: '1.0'
          memory: 1500M
    environment:
      PULSAR_MEM: -Xms600M -Xmx600M
    image: docker.io/apachepulsar/pulsar:3.3.1
    ports:
    - 6650:6650
    - 8080:8080
    restart: on-failure:100
    volumes:
    - pulsar-data:/pulsar/data
  qdrant:
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 1024M
        reservations:
          cpus: '0.5'
          memory: 1024M
    image: docker.io/qdrant/qdrant:v1.11.1
    ports:
    - 6333:6333
    - 6334:6334
    restart: on-failure:100
    volumes:
    - qdrant:/qdrant/storage
  query-doc-embeddings:
    command:
    - de-query-qdrant
    - -p
    - pulsar://pulsar:6650
    - -t
    - http://qdrant:6333
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  query-graph-embeddings:
    command:
    - ge-query-qdrant
    - -p
    - pulsar://pulsar:6650
    - -t
    - http://qdrant:6333
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  query-triples:
    command:
    - triples-query-neo4j
    - -p
    - pulsar://pulsar:6650
    - -g
    - bolt://neo4j:7687
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  store-doc-embeddings:
    command:
    - de-write-qdrant
    - -p
    - pulsar://pulsar:6650
    - -t
    - http://qdrant:6333
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  store-graph-embeddings:
    command:
    - ge-write-qdrant
    - -p
    - pulsar://pulsar:6650
    - -t
    - http://qdrant:6333
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  store-triples:
    command:
    - triples-write-neo4j
    - -p
    - pulsar://pulsar:6650
    - -g
    - bolt://neo4j:7687
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  text-completion:
    command:
    - text-completion-openai
    - -p
    - pulsar://pulsar:6650
    - -x
    - '4096'
    - -t
    - '0.300'
    - -m
    - gpt-4o
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    environment:
      OPENAI_TOKEN: ${OPENAI_TOKEN}
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  text-completion-rag:
    command:
    - text-completion-openai
    - -p
    - pulsar://pulsar:6650
    - -x
    - '4096'
    - -t
    - '0.300'
    - -m
    - gpt-4o
    - -i
    - non-persistent://tg/request/text-completion-rag
    - -o
    - non-persistent://tg/response/text-completion-rag-response
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          cpus: '0.1'
          memory: 128M
    environment:
      OPENAI_TOKEN: ${OPENAI_TOKEN}
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
  vectorize:
    command:
    - embeddings-vectorize
    - -p
    - pulsar://pulsar:6650
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
        reservations:
          cpus: '0.5'
          memory: 512M
    image: docker.io/trustgraph/trustgraph-flow:0.14.17
    restart: on-failure:100
volumes:
  grafana-storage: {}
  neo4j: {}
  prometheus-data: {}
  pulsar-data: {}
  qdrant: {}
JackColquitt commented 21 hours 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!

JackColquitt commented 21 hours ago

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.

kun432 commented 9 hours ago

@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.

kun432 commented 8 hours ago

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?

JackColquitt commented 5 hours ago

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.

cybermaggedon commented 4 hours ago

Great bug, thanks for raising @kun432

We're gonna change everything to OPENAI_TOKEN. The documentation wins out.