Skip to content

Error creating openai_vector_store_file resources #35

@arnodirlam

Description

@arnodirlam

Terraform Version

Terraform v1.13.2
on darwin_arm64

Provider Version

Providers required by configuration:
.
└── provider[registry.terraform.io/mkdev-me/openai] >= 0.1.0

Providers required by state:

    provider[registry.terraform.io/mkdev-me/openai]

Affected Resource(s)

  • openai_vector_store_file

Terraform Configuration Files

locals {
  kb_files = fileset(var.knowledgebase_dir, "**")
}

# 3.1 Create a vector store
resource "openai_vector_store" "app_kb" {
  name = "app-wissensbasis"
}

# 3.2 Upload files to OpenAI
resource "openai_file" "kb" {
  for_each = { for f in local.kb_files : f => f }

  # Local execution can access files from infra/ directory
  file    = "${var.knowledgebase_dir}/${each.value}"
  purpose = "assistants"
}

# 3.3 Attach files to the vector store for file_search
resource "openai_vector_store_file" "kb" {
  for_each        = openai_file.kb
  vector_store_id = openai_vector_store.app_kb.id
  file_id         = each.value.id
}

Debug Output

│ Error: Error reading vector store file: API error: No file found with id 'file-1DpaZta9xg4paUYU73jXpN' in vector store 'vs_69010cc814b48191b467bc9a5a6776cc'.
│ 
│   with openai_vector_store_file.kb["eBook MONEY MASTERY.md"],
│   on main.tf line 20, in resource "openai_vector_store_file" "kb":
│   20: resource "openai_vector_store_file" "kb" {
│ 
╵
╷
│ Error: Error reading vector store file: API error: No file found with id 'file-CNzxqKvaGuFTc1VEJ9QTwF' in vector store 'vs_69010cc814b48191b467bc9a5a6776cc'.
│ 
│   with openai_vector_store_file.kb["Grundlagen Guide.md"],
│   on main.tf line 20, in resource "openai_vector_store_file" "kb":
│   20: resource "openai_vector_store_file" "kb" {
│ 
╵

debug log: https://gist.github.com/arnodirlam/e4efbd7c1b5bef2d32710e129a95ddf4

Expected Behavior

The openai_vector_store_file should be created

Actual Behavior

Error reading vector store file after creation (probably to read the state and wait for completed)

Steps to Reproduce

See config above

Important Factoids

The same code used to work 5 days ago, so probably a change on OpenAI's side

References

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions