Code Monkey home page Code Monkey logo

Comments (2)

parthea avatar parthea commented on June 6, 2024

Hi @traed,

Thanks for sharing a code snippet. The snippet appears to work using the test values below.

import json
from google.cloud import discoveryengine_v1


doc_json = {
    "title": "Test document title",
    "body": "Test document description",
    "categories": ["sports > clip","sports > highlight"],
    "uri": "http://www.example.com",
}

document = discoveryengine_v1.Document()
document.json_data = json.dumps(doc_json)

client = discoveryengine_v1.DocumentServiceClient()
request = discoveryengine_v1.CreateDocumentRequest(
    parent="projects/python-docs-samples-tests/locations/global/dataStores/<datastore>/branches/default_branch",
    document_id="id",
    document=document,
)
client.create_document(request=request)

I tried removing the document_id argument of CreateDocumentRequest as a test to check the error message and received the error message google.api_core.exceptions.InvalidArgument: 400 Field "document_id" is a required field, but no value is found. [detail: "document_id". I would expect there should be more detail besides 400 Request contains an invalid argument. Please can you check whether the following results in more detailed error messages?

  • Upgrade google-api-core by running pip install --upgrade google-api-core
  • Try using REST instead of gRPC in case the error message from REST is more detailed. As a quick check try using client = discoveryengine_v1.DocumentServiceClient(transport="rest") instead of client = discoveryengine_v1.DocumentServiceClient()

Please let me know if the above steps help provide more error information.

from google-cloud-python.

parthea avatar parthea commented on June 6, 2024

I'm going to close this issue as more information is needed to help troubleshoot but please feel free to open a new issue with more information.

from google-cloud-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.