Error Messages/43024

Example error message

The Definition of Doc_section_embeddings contains an undefined identifier, Read_Vector_DB_For.
There is an object Vector_DB_library::Read_Vector_DB_For, but it is not visible from Doc_section_embeddings. This may be because the Vector_DB_library namespace is not imported by the AI_Assistant_Framework namespace, or because its namespace scope is Private.
Would you like to edit the Definition of Doc_section_embeddings?

Description

The extra details in the second paragraph of this error can vary, but the cause is always that an identifier used within an expression is not recognized. It might be that no object with that identifier exists (e.g., perhaps you have a mis-spelling in your expression) or it might happen (as with the example) that the object is out-of-scope (e.g., in a private namespace.

Bringing the object into scope

If it says the object exists but is not visible from your expression's namespace, you have a few options.

Importing the target namespace

The first option would be to import the object's namespace into your expression's namespace. First, you'll have to figure out what module is the namespace of your expression. It is probably your top-level model, which we'll assume in the next expression. Then you add the target namespace to your namespace's NamespaceImports attribute, listing each import an a separate line. You can do this programmatically with an expression like:

( NamespaceImports of (Sys_TopLevelModel) :=  JoinText([namespaceimports of (Sys_TopLevelModel),"hello"],,Chr(13)) )

If you do this from the Typescript console window, the parenthesis around the full expression is required (so that it interprets it as an expression, evaluating the right-hand side prior to the assignment). The parenthesis around (Sys_TopLevelModel) are also essential here since we are setting the attribute of the object pointed to by Sys_TopLevelModel not the attribute of Sys_TopLevelModel itself. The use of JoinText here works in the case you are appending to the end and in the case where this is the first assignment to the attribute.

Using a qualified name

Another option is to replace the (unqualified) identifier in your expression, Read_Vector_DB_For in the example, with a qualified name (which specifies a namespace path to the object). In this case, the replacement would be Vector_DB_library::Read_Vector_DB_For. The namespace path starts with an identifier that is in scope.

This brings the identifier into scope in two important cases: (1) When the namespace itself wasn't imported, and (2) when the namespace was imported but the target object itself has a private namespace scope. In the second case, when an object has a private namespace scope it usually means that the author of the library did not intend for you to use the object directly, so you should likely reconsider using that object in the first place (e.g., it may be subject to change in the future).

See also

Comments


You are not allowed to post comments.