garak icon indicating copy to clipboard operation
garak copied to clipboard

Fix `NvcfGenerator` for NIM update

Open erickgalinkin opened this issue 1 year ago • 4 comments

NIM updates have totally changed the way we interact with NVCF.

Example code for correct interaction with NIMs:

from openai import OpenAI

client = OpenAI(
  base_url = "https://integrate.api.nvidia.com/v1",
  api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
)

completion = client.chat.completions.create(
  model="meta/codellama-70b",
  messages=[{"role":"user","content":""}],
  temperature=0.1,
  top_p=1,
  max_tokens=1024,
  stream=True
)

for chunk in completion:
  if chunk.choices[0].delta.content is not None:
    print(chunk.choices[0].delta.content, end="")

erickgalinkin avatar Mar 19 '24 13:03 erickgalinkin

Does the old API no longer work? OpenAI's module doesn't support multiprocessing, making scans with it intractable

leondz avatar Mar 19 '24 14:03 leondz

@leondz it does not seem to, no. Will ping you offline to discuss further.

erickgalinkin avatar Mar 19 '24 14:03 erickgalinkin

New REST API is up w/ direct HTTP access, will adapt this generator accordingly

leondz avatar Apr 11 '24 19:04 leondz

NVCF now seems to be around in its original form - see NVCF API docs. Catalog items on AI Catalog that have not been migrated to NIM seem (from their descriptions) to still be available via NVCF. Needs testing.

leondz avatar Apr 30 '24 10:04 leondz