Skip to content

update python code correctness - #781

Open
OscarDDD wants to merge 15 commits into
mainfrom
update_python_code_correctness
Open

OscarDDD wants to merge 15 commits into
mainfrom
update_python_code_correctness

Conversation

@OscarDDD

@OscarDDD OscarDDD commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Has Changed?

Fix the correctness of the code snippets in the python docs. Since the orchestration-service is going to be deprecated soon, its content is currently not considered.

@OscarDDD
OscarDDD marked this pull request as ready for review September 30, 2026 14:33

@mwien mwien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just a bunch of smaller comments

response = client.models.generate_content(model="gemini-3.5-flash",
contents="Explain the theory of relativity in simple terms.")
print(response)
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[req] I'm getting the warning Direct use of automatic function calling (AFC) in Models.generate_content is not recommended. Instead, we recommend to use AFC in Chat.send_message. Similarly, direct use of AFC in Models.generate_content_stream is not recommended. Instead, we recommend to use AFC in Chat.send_message_stream. when I run this.


question = "What NFL team won the Super Bowl in the year Justin Bieber was born?"
print(llm_chain.invoke({'question': question}))
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[req] Getting this warning:
UserWarning: WARNING! root_client is not default parameter. root_client was transferred to model_kwargs. Please confirm that root_client is what you intended. exec(code, self.locals) UserWarning: WARNING! root_async_client is not default parameter. root_async_client was transferred to model_kwargs. Please confirm that root_async_client is what you intended. exec(code, self.locals)

Comment thread docusaurus.config.js
{
label: 'SAP Cloud SDK (Python) - GitHub',
href: 'https://github.com/SAP/ai-sdk-python'
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[req] As discussed, let's keep these layout/template changes out of this PR

Comment thread docusaurus.config.js
},
{
label: 'Support',
to: 'docs/overview/get-support'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[req] As discussed, let's keep these layout/template changes out of this PR

from google.genai.types import GenerateContentConfig

def stream_genai(prompt, model_name='gemini-2.0-flash'):
def stream_genai(prompt, model_name='gemini-3.5-flash'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[req] I'm getting the warning Direct use of automatic function calling (AFC) in Models.generate_content_stream is not recommended. Instead, we recommend to use AFC in Chat.send_message_stream. Similarly, direct use of AFC in Models.generate_content is not recommended. Instead, we recommend to use AFC in Chat.send_message.

---

The Document Grounding module implements Retrieval Augmented Generation (RAG). It is a module in the [Orchestration Service](./orchestration-service2.mdx). It uses the SAP HANA Vector Engine to retrieve relevant document context (the "context") and generate more accurate responses.
The Document Grounding module implements Retrieval Augmented Generation (RAG). It is a module in the [Orchestration Service·](./orchestration-service2.mdx). It uses the SAP HANA Vector Engine to retrieve relevant document context (the "context") and generate more accurate responses.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pp, q] why the change here? is it just the extra space after Orchestration Service? If so, remove.

trigger_res = pipelines.trigger_pipeline(trigger_req)
```

The trigger request returns immediately with a `202` response, but the pipeline does not transition to `INPROGRESS` right away. There is a short delay — typically a few seconds — before the pipeline actually starts executing. Poll `get_pipeline_status` until the status changes from `NEW` to `INPROGRESS` before proceeding.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pp] Make this shorter, just mention that it's necessary to wait till INPROGRESS before proceeding. Also, for me it took more than a few seconds, but maybe that was just due to other reasons such as downtime of the service


### Executions and Documents

Execution records become available shortly after the pipeline starts. Querying executions immediately after triggering may result in a `404` error until the pipeline has had time to initialize.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pp, q] Is it just about the remark above that one needs to wait till INPROGRESS? Then I think we do not need this additional comment about it.


# Alternative initialization from environment
# client = EvaluationClient.from_env()
client = EvaluationClient.from_env()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pp, q] is switching to the env file init strictly necessary?

response = await bedrock.converse_stream(
messages=conversation,
inferenceConfig={"maxTokens": 512, "temperature": 0.0, "topP": 0.9},
inferenceConfig={"maxTokens": 300, "temperature": 0.0, "topP": 0.9},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] any reason for the change to maxTokens

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants