text:
How to prevent Kysely from crashing node app if database goes down

Hi All,
I am trying to incorporate Kysely into a larger Node.js application to write data to a MSSQL database. I create a instance of Kysely exactly like in the doc as shown below and execute inserts with an error catch handler however when the SQL database is not reachable the whole node application crashes.
How can I best handle situation where the SQL database is unreachable without it crashing the whole app?
db
        .insertInto('commandQueue').values({
            command,
            status: 'pending',
            terminal_id: terminalId,
            server_flag: msgId,
        })
        .execute()
        .then(() => console.log(date.toLocaleTimeString(),`[${terminalId}]`, `command ${command} queued`))
        .catch(e => console.log(e))

Error
TimeoutError: Failed to connect to localhost:1433 - Could not connect (sequence)
    at /Users/anthonyphan/repos/nex-gps/node_modules/tarn/dist/PendingOperation.js:14:27
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:538:9)
    at processTimers (node:internal/timers:512:7)
    at async MssqlDriver.acquireConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/dialect/mssql/mssql-driver.js:40:16)
    at async RuntimeDriver.acquireConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/driver/runtime-driver.js:46:28)
    at async DefaultConnectionProvider.provideConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:10:28)
    at async DefaultQueryExecutor.executeQuery (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
    at async InsertQueryBuilder.execute (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/query-builder/insert-query-builder.js:528:24)
/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/dialect/mssql/mssql-driver.js:40
        return await this.#pool.acquire().promise;
               ^
TimeoutError: Failed to connect to localhost:1433 - Could not connect (sequence)
    at /Users/anthonyphan/repos/nex-gps/node_modules/tarn/dist/PendingOperation.js:14:27
    at async MssqlDriver.acquireConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/dialect/mssql/mssql-driver.js:40:16)
    at async RuntimeDriver.acquireConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/driver/runtime-driver.js:46:28)
    at async DefaultConnectionProvider.provideConnection (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:10:28)
    at async DefaultQueryExecutor.executeQuery (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
    at async InsertQueryBuilder.execute (/Users/anthonyphan/repos/nex-gps/node_modules/kysely/dist/cjs/query-builder/insert-query-builder.js:528:24)
[nodemon] app crashed - waiting for file changes before starting...

Creating Kysely instance
import { Database } from './types.ts' // this is the Database interface we defined earlier
import * as tedious from 'tedious'
import * as tarn from 'tarn'
import { Kysely, MssqlDialect } from 'kysely'

const dialect = new MssqlDialect({
  tarn: {
    ...tarn,
    options: {
      min: 0,
      max: 10,
    },
  },
  tedious: {
    ...tedious,
    connectionFactory: () => new tedious.Connection({
      authentication: {
        options: {
          password: 'password',
          userName: 'username',
        },
        type: 'default',
      },
      options: {
        database: 'some_db',
        port: 1433,
        trustServerCertificate: true,
      },
      server: 'localhost',
    }),
  },
})

// Database interface is passed to Kysely's constructor, and from now on, Kysely
// knows your database structure.
// Dialect is passed to Kysely's constructor, and from now on, Kysely knows how
// to communicate with your database.
export const db = new Kysely<Database>({
  dialect,
})

Are you absolutely sure you don't have some place without an exception handler? The stack trace shows the error comes all the way up to the execute method. After that it's just a standard Promise. We don't do anything special there. I don't see how this could be caused by Kysely.

Hi @koskimas
Thanks for pointer. I went back over the code base to check for instances of execute() without a catch and did find a few, this was the cause of the error above.
However after I ensure a .catch on all instance of execute()  i'm still able to crash the node serve by toggling the SQL db off and on. Im not sure if this is actually due to Kysely however i've attached an error log below incase you can spot the issue.
/Users/anthonyphan/repos/nex-gps/node_modules/tedious/src/connection.ts:2313
      this.emit('error', new ConnectionError(message, 'ESOCKET'));
                         ^
ConnectionError: Connection lost - socket hang up
    at Connection.socketError (/Users/anthonyphan/repos/nex-gps/node_modules/tedious/src/connection.ts:2313:26)
    at Connection.socketEnd (/Users/anthonyphan/repos/nex-gps/node_modules/tedious/src/connection.ts:2326:12)
    at Socket.<anonymous> (/Users/anthonyphan/repos/nex-gps/node_modules/tedious/src/connection.ts:1997:35)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ESOCKET'
}
[nodemon] app crashed - waiting for file changes before starting...

I'm not seeing any uncaught exception errors in the log, so it's unclear what's actually crashing the server.
@igalklebanov Any ideas? Could it be we're not listening to the error event and it "leaks out"?

I think i might have resolved the issue by creating the the dialect as show below with the error handler. Unsure if this is user error or if the Kysely library should of caught that error. Either way i'm happy that we got to the bottom of it :) Appreciate the help!
import { Database } from './types.ts' // this is the Database interface we defined earlier
import * as tedious from 'tedious'
import * as tarn from 'tarn'
import { Kysely, MssqlDialect } from 'kysely'

const dialect = new MssqlDialect({
  tarn: {
    ...tarn,
    options: {
      min: 0,
      max: 10,
    },
  },
  tedious: {
    ...tedious,
    connectionFactory: () => new tedious.Connection({
      authentication: {
        options: {
          password: 'password',
          userName: 'username',
        },
        type: 'default',
      },
      options: {
        database: 'some_db',
        port: 1433,
        trustServerCertificate: true,
      },
      server: 'localhost',
    }).on('error', console.log),
  },
})

// Database interface is passed to Kysely's constructor, and from now on, Kysely
// knows your database structure.
// Dialect is passed to Kysely's constructor, and from now on, Kysely knows how
// to communicate with your database.
export const db = new Kysely<Database>({
  dialect,
})

I think this is something Kysely should do automatically

@koskimas @AnthonyPhan Yeah, haven't handled this one. Let's do it.

authors: AnthonyPhan igalklebanov koskimas

repo: kysely-org/kysely


text:
feat: replaced kytos/mef_eline.loaded with kytos/mef_eline.evcs_loaded

Closes #66
This PR is on top of PR #67
This PR depends on https://github.com/kytos-ng/mef_eline/pull/401
Summary

feat: replaced kytos/mef_eline.loaded with kytos/mef_eline.evcs_loaded
This NApp hasn't been released yet no need to update changelog

Local Tests

Created with INT EVCs and restarted, the expected srcs_pp (source proxy ports) were correctly loaded too:

kytos $> controller.napps[('kytos', 'telemetry_int')].int_manager.srcs_pp
    ...:
Out[1]:
{'00:00:00:00:00:00:00:01:5': ProxyPort(Interface('s1-eth5', 5, Switch('00:00:00:00:00:00:00:01')), Interface('s1-eth6', 6, Switch('00:00:00:00:00:00:00:01')), EntityStatus.UP),
 '00:00:00:00:00:00:00:01:7': ProxyPort(Interface('s1-eth7', 7, Switch('00:00:00:00:00:00:00:01')), Interface('s1-eth8', 8, Switch('00:00:00:00:00:00:00:01')), EntityStatus.UP),
 '00:00:00:00:00:00:00:03:5': ProxyPort(Interface('s3-eth5', 5, Switch('00:00:00:00:00:00:00:03')), Interface('s3-eth6', 6, Switch('00:00:00:00:00:00:00:03')), EntityStatus.UP)}

kytos $> srcs_pp = controller.napps[('kytos', 'telemetry_int')].int_manager.srcs_pp
    ...:

kytos $> srcs_pp['00:00:00:00:00:00:00:01:5'].evc_ids
Out[3]: {'735fa71d2f4f4d', 'a928a2bbfb4d47'}

End-to-End Tests
N/A yet

LGTM

Appreciated your review, Italo.

source: gharchive/pull-request

license: MIT

license_type: permissive

license_source: github-api


text:
🛑 Korone is down

In 9af8696, Korone (korone.kyun.host) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Korone is back up in 7395aeb after 90 days, 14 hours, 51 minutes.

source: gharchive/issue

repo: kyundothost/status


text:
update releases

Signed-off-by: Jim Bugwadia jim@nirmata.com

remove release notes from docs; refer to GitHub release notes instead
update release management

So looks like you're not a fan of having release notes on the website in addition to GitHub. You just think it's unnecessary duplication?

Hi @chipzoller - yes!
Its hard to maintain, and the information gets out-of-date often.
We can improve the format and content of the release notes on GitHub, to add standard categories, contributors, changelog, etc. and use the auto-generate feature:
https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

Sounds good to me!

authors: JimBugwadia chipzoller

repo: kyverno/website


text:
Leverage ContentMD5 header if present

To validate downloaded file contents

On PR #5, you commented:

Maybe this could be complemented for even more strong download guarantees with #1 🤔

The complexity of getting this right is not worth the effort. What's more, the Content-MD5 header (RFC 1864) was designed as an additional check for problems that can occur with MIME mail. The introduction section of RFC 1864 lays out the problem statement:

Despite all of the mechanisms provided by MIME which attempt to data from being damaged in the course of email transport, it is still desirable to have a mechanism for verifying that the data, once decoded, are intact.

The complexity stems from the fact that the MD5 digest should be generated for some canonical form:

In particular, this means that the sender applies the MD5 algorithm on the data immediately after conversion to canonical form, before applying any content-transfer-encoding, and that the receiver also applies the MD5 algorithm on the canonical form, after undoing any content-transfer-encoding.

For text, this has much to do with newline conversion (see Appendix G of RFC 1521). However, this requires that the media type communicated in Content-Type is present and accurate so text types can be identified and converted to their canonical form (which in turn requires an up to date registry of MIME types in the client code). Not all web servers may communicate the media type and could be incorrect in the worst case, which would lead to false negatives about content integrity. You cannot even assume binary in the absence of a media type since it may lead to an incorrect digest if the canonical form of the object is not used. A workaround would be to compute the digest assuming binary content and if the check passes then carry on. Otherwise compute and check the digest assuming text and applying canonical form rules; fail integrity check if this doesn't pass.
But never mind all that because Content-MD5 was deprecated in RFC 7231:

The Content-MD5 header field has been removed because it was inconsistently implemented with respect to partial responses.

See also httpwg/http-core#93 for background and discussion.
The better way forward is to go with RFC 3230 (Instance Digests in HTTP) and request a digest via the Want-Digest header (preferring SHA-1):
Want-Digest: sha

and then checking the integrity if a Digest header, like:
Digest: sha=thvDyvhfIqlvFe+A9MYgxAfm1q5=

is present.
I also recommend issuing a warning to standard error when the content integrity check fails and field-testing for a few releases before hardening it into an error.

That's outstanding research and background info to improve on this suggestion. Thanks a lot @atifaziz!
I just verified that github.com does not return the digest if requested in that way, so I'd say it's pointless to implement.
I'll close this then.
Thanks again!

authors: atifaziz kzu

repo: kzu/dotnet-file


text:
an empty pop-up window will be displayed

@Andrew-Sem
Steps:

I type something into the search engine
Erasing symbols in the search

@SergeyShapovaIov didn't get this bug
https://github.com/l3r8yJ/volpi-qa/assets/101043571/508f0de2-b510-492f-b2f4-72d6fb87e401
Can u please record it?

@SergeyShapovaIov take a look, please

This issue is appear only when there is no backend. So, chat should handle it
@l3r8yJ, assign me, please

authors: Andrew-Sem SergeyShapovaIov l3r8yJ


text:
PR Team intrapage

General Checks

[ ] the branch is up to date with main/master
[ ] the code works when pulled and run locally
[ ] All CI checks pass
[ ] all conflicts are resolved (if any)
[ ] PR has a descriptive title
[ ] PR has appropriate labels and milestones for easy identification
[ ] PR it is assigned to the owner
[ ] reviewers are assigned
[ ] the PR contributes only one focused change
[ ] It is in the appropriate column in the project board (if necessary)
[ ] has short and clear description
[ ] is linked to an issue (if it is related)
[ ] feedback is addressed (if any and if it is appropriate feedback.)

Markdown

[ ] the markdown source is formatted
[ ] spelling and grammar is correct in all text
[ ] The markdown looks correct when you preview the file
[ ] all links and images work

HTML

[ ] pages besides /index.html are stored in /pages
[ ] the code is well-formatted
[ ] the HTML is valid
[ ] there are no inline styles (example: style='color: red;')
[ ] there are no <style> tags with CSS, all styles are hrefs
[ ] there is no inline JavaScript (example: onclick='doSomething()')
[ ] there are no <script> tags with JS, all JS is in an separate file
[ ] ids are used for JavaScript only, not for CSS
[ ] semantic tags are used
[ ] spelling and grammar is correct in all site content

CSS

[ ] the code is well-formatted
[ ] passes all the linting checks

@TheRick88 good job )


text:
fix: create copy of labels for label counts

For counting the labels, create a copy of the labels object as the original object can change during the calculation

Codecov Report

Merging #257 (b806452) into main (4c1316e) will decrease coverage by 0.00%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
- Coverage   81.91%   81.91%   -0.01%
==========================================
  Files          56       56
  Lines        3738     3737       -1
==========================================
- Hits         3062     3061       -1
  Misses        676      676

Impacted Files
Coverage Δ

...h/data_access/file_based/file_based_data_access.py
91.89% <75.00%> (-0.04%)
:arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

authors: arielge codecov-commenter

repo: label-sleuth/label-sleuth


text:
【Auto-build】k9s

Usage:
   /imagebuild_apps appName appVersion
Available Args:
   appName:  current app dir
   appVersion: current app version

Example:
   /imagebuild_apps helm v3.8.2

/imagebuild_apps k9s v0.26.7

repo: labring-actions/cluster-image


text:
Poss. upload updates for config.json

Keeping track of a few nice things to have if a non-breaking update is possible for uploading and expanding config.json.

In featureData: [...] an 'area' key to csv column header reference.

Probably need to have an upload for phenotype map csv and col. ref.


text:
Inject SSM value while registering instances

I have followed the guide on @laconia/config but I couldn't see an option to inject mySecret while registering instances. A code snippet is as below:
const instances = async () => ({   userService: UserService.build(), });
laconia(handler).register(instances);
Requirement is to provide mySecret to UserService.build(). Currently, I am using aws-sdk inside UserService to get SSM value.

Thanks for reporting this issue. The register function's first parameter is actually laconiaContext object. It is briefly documented here: register function.
That means, if you're trying to retrieve a secret and injecting it into UserService, you would be able to do the following:
const instances = async ({ mySecret }) => ({ userService: UserService.build(mySecret) });

laconia(handler).register(instances);

I'll make sure that this is documented in laconia's website. Thank you!

repo: laconiajs/laconia


text:
How can I extend the Directive

I would like to extend your NgxTribute directive so I can create a wrapper for additional functionality.
I've originally have tried something like this -
import {NgxTributeDirective} from "ngx-tribute/lib/ngx-tribute.directive";
@Directive({
  selector: '[tagging]' // Attribute selector
})
export class TaggingDirective extends NgxTributeDirective<any> {

  constructor(element: ElementRef, formControlName: FormControlName, formControlDirective: FormControlDirective, ngModelDirective: NgModel) {
    super(element, formControlName, formControlDirective, ngModelDirective)

    this.options = {
      values: [{value: 'Phil Heartman', firstName: 'pheartman'},
        {value: 'Gordon Ramsey', firstName: 'gramsey'}],
      selectTemplate: function (item) {
        return ''  +item.original.value  +'';
      },
    };
  }
}

But I get the following error - Uncaught Error: Cannot find module "ngx-tribute/lib/ngx-tribute.directive"

Please update to the latest version, the directive class was not exposed from the NPM module.
After updating you should be able to do:
import {NgxTributeDirective} from "ngx-tribute";

Remember to add @Optional() decorators to params of constructor. Check https://github.com/ladderio/ngx-tribute/blob/master/projects/ngx-tribute/src/lib/ngx-tribute.directive.ts#L22

Awesome thanks 👍

authors: agarbund thecoconutstudio

repo: ladderio/ngx-tribute


text:
Readme update

Closes #84

Perfect – that you sir! 👍

authors: franciscocpg mhart

repo: lambci/lambci

license: mit

license_source: bigquery


text:
Shouldn't escape_to_string escape ' characters?

I note that escape_to_string doesn't currently escape ' characters. IIUC these can be used to delimit attributes, so I'd have thought you'd want to escape them. Is that wrong?

Ah, maybe this doesn't matter because you always generate double-quoted attributes. Sorry if that's the case! Just doing a drive-by low-effort audit while trying to evaluate templating options.

Indeed, we only emit double-quoted attributes so it doesn't matter.
Technically we don't have to escape > either, but that might offend the XML folks.

authors: benwr lambda-fairy

repo: lambda-fairy/maud


text:
Cairo1 proof mode

Cairo1 proof mode
Description
This PR adds an initial working version of Cairo1 proof mode

Adds a proof mode header, working very similarly to the Cairo0 proof mode header to the code
Makes some small changes to SW Cairo header, so the pointers to the segment are properly aligned now that there are two extra instructions
Adds a RunnerMode to select from ExecutionMode, ProofModeCanonical, and ProofModeCairo1
Adds a test for dictionaries in cairo1, since they work a bit different in the headers and wasn't being tested
Reduces the number of iterations of the sample program to 100 so Cairo1 tests run faster

In the future information should be added so [fp - 2] = fp can be enforced

should add a command line argument to set the run to proof_mode instead of just running proof_mode by default

Yes @fmoletta, that is the plan
We talked with Mauro, first we can merge this to run always on proof mode, and then we can make a refactor so the user can decide if he wants to execute in proof mode or not

authors: MauroToscano pefontana

repo: lambdaclass/cairo-vm


text:
Curve point evaluation output should be validated. It can be infinity

Context: P256VERIFY.yul#L606
Description:
According to ecdsa algorithm description after Step 5 it we should validate that the result is not infinity. Otherwise we should return invalid signature.
Current implementation does not do it which results passing 0 to montgomeryModularInverse. This is unexpected input value for the function which results endless loop.
This happens for case when i.e. r == hash and Q == -G
Recommendation:
Add additional check on zr value and handle it returning 0 (invalid signature)
0x5ad83880e16658d7521d4e878521defaf6b43dec1dbd69e514c09ab8f1f2ffe25ad83880e16658d7521d4e878521defaf6b43dec1dbd69e514c09ab8f1f2ffe2871c518be8c56e7f5c901933fdab317efafc588b3e04d19d9a27b29aad8d9e696b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296b01cbd1c01e58065711814b583f061e9d431cca994cea1313449bf97c840ae0a.
diff --git a/precompiles/P256VERIFY.yul b/precompiles/P256VERIFY.yul
index c75be80..c650a35 100644
--- a/precompiles/P256VERIFY.yul
+++ b/precompiles/P256VERIFY.yul
@@ -604,6 +604,10 @@ object "P256VERIFY" {
             let t1 := outOfMontgomeryForm(montgomeryMul(r, s1, N(), N_PRIME()), N(), N_PRIME())

             let xr, yr, zr := shamirLinearCombination(x, y, z, t0, t1)
+            if iszero(zr) {
+                mstore(0, 0)
+                return(0, 32)
+            }

             // As we only need xr in affine form, we can skip transforming the `y` coordinate.
             let z_inv := montgomeryModularInverse(zr, P(), R2_MOD_P())

Resolved in #200


text:
include codemirror static files

I've seen other similar django widgets that package the static files with the codemirror app, default CODEMIRROR_PATH to use the pre-pacakged static files, and allow the user to override the setting.
Would you be interested in a PR that does something like this? It would make installing and using the package easier along with getting rid of a bunch of static files from my main repository. Thanks!

If the license is ok, I would merge such PR thanks!

authors: AlJohri lambdalisue

repo: lambdalisue/django-codemirror-widget


text:
compatible with php 8.0

This pull request is for an issue #14

Q
A

Documentation
no

Bugfix
no

BC Break
no

New Feature
yes

RFC
no

QA
yes

Coverage seems not generated, as it seems uses Xdebug 3 at https://travis-ci.com/github/laminas/laminas-console/jobs/472135358
$ if [[ $TEST_COVERAGE == 'true' ]]; then vendor/bin/php-coveralls -v ; fi

In Configurator.php line 152:

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]

  coverage_clover XML file is not readable: /home/travis/build/laminas/laminas-console/clover.xml

The warning is on phpunit run itself:
Runtime:       PHP 7.3.26

Configuration: /home/travis/build/laminas/laminas-console/phpunit.xml.dist

Warning:       XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

You may need to add  :
env:
 - XDEBUG_MODE=coverage

to make it works.

Coverage seems not generated, as it seems uses Xdebug 3 at https://travis-ci.com/github/laminas/laminas-console/jobs/472135358
$ if [[ $TEST_COVERAGE == 'true' ]]; then vendor/bin/php-coveralls -v ; fi

In Configurator.php line 152:

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]

  coverage_clover XML file is not readable: /home/travis/build/laminas/laminas-console/clover.xml

The warning is on phpunit run itself:
Runtime:       PHP 7.3.26

Configuration: /home/travis/build/laminas/laminas-console/phpunit.xml.dist

Warning:       XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

You may need to add  :
env:
 - XDEBUG_MODE=coverage

to make it works.

No test case was removed because it fell 0.08%

No test case was removed because it fell 0.08%

@juizmill Sadly, I've created #13  and #15 even tho, this package was long time unmaintained.
I've failed on that.
So this package will not receive any further updates as it is superseded by https://docs.laminas.dev/laminas-cli/
If you are using this package, we highly encourage you to migrate to that package.
Sorry if this made you wasting your time.

@juizmill Sadly, I've created #13  and #15 even tho, this package was long time unmaintained.
I've failed on that.
So this package will not receive any further updates as it is superseded by https://docs.laminas.dev/laminas-cli/
If you are using this package, we highly encourage you to migrate to that package.
Sorry if this made you wasting your time.

Reference:

https://github.com/laminas/laminas-console#deprecated
https://docs.laminas.dev/laminas-console/
https://docs.laminas.dev/components/#deprecated-packages

Reference:

https://github.com/laminas/laminas-console#deprecated
https://docs.laminas.dev/laminas-console/
https://docs.laminas.dev/components/#deprecated-packages

authors: boesing froschdesign juizmill samsonasik

repo: laminas/laminas-console


text:
🎨 Simplify use case

Fetches the input Artifact directly from lamindata
Improves the intro text

There's a failed run on lamindata, could you clean it up and add a successful one?

Also this run misses outputs:

This is great! It's very easy to understand & makes total sense now.
The only confusing thing is that you're using ln.track() within the registration (aka wrapper/glue) script.
I think it'd make more sense to simply create a run object and annotating it with inputs, outputs, and the correct timestamps.
ln.track() really is built for notebooks & scripts that serve the role of a data transformation. But here we're working with a mere registration/wrapper/glue script.

Hence, I refactored the script a bit. What's missing is adding the correct timestamps.
I'll look into the JSON field issue tomorrow. 505 lines of JSON 🤯 ...

Sorry for breaking things, @Zethson. I hope this refactor fixes it.
Will work on the JSON issue now.

@falexwolf it didn't. Something in the script must still be wrong. I will look into it after breakfast while you're looking at the JSON stuff.

authors: Zethson falexwolf sunnyosun

repo: laminlabs/nextflow-lamin


text:
Dataframe: access to dotted field names like SQL

In the where clause, the SQL query can access arbitrarily nested fields, but this is not possible with the dataframe, e.g. I want to be able to do:
df = tbl.search().to_pandas()

and be able to see all nested fields of the schema as top-level columns in df.
Among other things this would enable pandas queries like df.query(...)

Hmm if I could I would add a flatten parameter to to_pandas(), but we don't control that method (it's in PyArrow).
Other DataFrames do have decent support for nested columns, such as Polars. So I don't think flattening in general is what we want.
Perhaps we can provide a helpful snippet to teach them how to unflatten a column? IIRC it's just something like:
df.assign(nested = lambda df: [x['key'] for x in df['struct']])

@pchalasani i think we can do this in LanceDB repo instead of the format level (please see the referencing PR)

Nice, thanks, I seem to be conflating the two repos in my mind 😀

For future reference for Lance users, you can write:
dataset.to_table(...).flatten().to_pandas()

If you have multiple levels of nested fields, you may need to call flatten() multiple times.
Maybe I can make this a tip in the user guide?

Yes an example in the user guide would help, thanks
On Dec 20, 2023 at 12:00 PM -0500, Will Jones @.***>, wrote:

For future reference for Lance users, you can write:
dataset.to_table(...).flatten().to_pandas()
If you have multiple levels of nested fields, you may need to call flatten() multiple times.
Maybe I can make this a tip in the user guide?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: @.***>

authors: changhiskhan pchalasani wjones127

repo: lancedb/lance


text:
bug(node/vectordb): schema mismatch when using custom embedding function

LanceDB version
v0.4.19
What happened?
When adding data, we get the error:
TypeError: Table and inner RecordBatch schemas must be equivalent.

This comes from the line:
https://github.com/apache/arrow/blob/6a28035c2b49b432dc63f5ee7524d76b4ed2d762/js/src/table.ts#L136-L137
The one difference is that in schema, vector is not nullable, while in batch.schema, vector is nullable.
Are there known steps to reproduce?
Here is the user provided repro: https://paste.mozilla.org/udbe1bNs
Original message: https://discord.com/channels/1030247538198061086/1197630540271067258/1237552085525074000
Copy of repro
import lancedb from 'vectordb'
import express from 'express'
import { pipeline } from '@xenova/transformers'
import { Schema, Field, FixedSizeList, Float64, Int32, Utf8 } from "apache-arrow";

const pipe = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2');
const db = await lancedb.connect('data/sample-lancedb')

const embed_fun = {
    sourceColumn: 'text',
    embed: async function (batch) {
        let result = []
        for (let text of batch) {
            const res = await pipe(text, { pooling: 'mean', normalize: true })
            result.push(Array.from(res['data']))
        }
        return (result)
    }
}

const schema = new Schema([
    new Field("id", new Int32()),
    new Field("text", new Utf8()),
    new Field("type", new Utf8()),
    new Field("vector", new FixedSizeList(384, new Field("item", new Float64())))
]);

debugger;

const tables = await db.tableNames()
let table
if (!tables.includes("food_table")) {
    table = await db.createTable({ name: "food_table", schema, embed_fun })
} else {
    table = await db.openTable('food_table', embed_fun)
}

const app = express()
app.use(express.json())

app.get('/', async (req, res) => {
    const results = await table
        .search("a sweet fruit to eat")
        .metricType("cosine")
        .limit(2)
        .execute()
    res.json(results)
})

app.post('/', async (req, res) => {
    await table.add(req.body)
    res.send('OK')
})

const port = 3000
app.listen(port, () => {
    console.log(`Listening port on ${port}`)
})

curl --location 'http://localhost:3000' \
--header 'Content-Type: application/json' \
--data '[
    { "id": 2, "text": "Carrot", "type": "vegetable" },
    { "id": 3, "text": "Potato", "type": "vegetable" },
    { "id": 4, "text": "Apple",  "type": "fruit" },
    { "id": 5, "text": "Banana", "type": "fruit" }
]'

TypeError: Table and inner RecordBatch schemas must be equivalent.

This appears to be due to the fact that the user is specifying the "vector" column which is also the output of the embed function. The application logic is unable to handle this scenario.

Does that mean we should be validating this at the time of create_table()?

i guess it depends on how we want to handle this. Do we want to treat this as a user error, or do we want to add logic to check for columns matching the embedding functions?

If you look at the Python examples, we have users providing the vector column in the Pydantic schema: https://lancedb.github.io/lancedb/embeddings/#openai-embedding-function
So it feels inconsistent that in the JS library we would tell them not to do that, right?

repo: lancedb/lancedb


text:
Misleading help for sha1sum

Help for sha1sum says syntax is:
usage: sha?sum [-b] [-c FILE] [FILE]...
Which leads user to believe other sha commands would also be supported, for example, sha512sum. However, only sha1sum can be used in Toybox. Perhaps, it would be nice making it clear that other sha commands are not yet available here.

On 06/29/2018 01:35 AM, Ricardo wrote:

Help for |sha1sum| says syntax is:
|usage: sha?sum [-b] [-c FILE] [FILE]...|
Which leads user to believe other sha commands would also be supported, for
example, |sha512sum|. However, only |sha1sum| can be used in Toybox. Perhaps, it
would be nice making it clear that other sha commands are not yet available here.

They're available now if you enable ssl library support, and implementing local
versions is in the todo list (https://landley.net/toybox/status.html#todo) and
the roadmap (https://landley.net/toybox/roadmap.html).
Rob

What are "local versions"?
Don't you have a bin with it enabled already? The ones in http://landley.net/toybox/downloads/binaries/ are disabled, right?

On 06/29/2018 03:10 PM, Ricardo wrote:

What are "local versions"?

A version implemented in toybox's C code rather than an external library, so it
can be a self-contained project providing all its own prerequisites and minimize
the circular dependencies at the start of hermetic build system bootstrapping.
As opposed to the external library callout ala:
https://github.com/landley/toybox/blob/master/toys/lsb/md5sum.c#L245
and
https://github.com/landley/toybox/blob/master/toys/lsb/md5sum.c#L340

Don't you have a bin with it enabled already? The ones in
http://landley.net/toybox/downloads/binaries/ are disabled, right?

The prebuilt binaries are defconfig, enabling all the completed built-in code.
They doesn't use the optional zlib or libssl callouts, if you want that you have
to enable those config symbols (in "make menuconfig" (under "toybox global
settings", Use libcrypto and Use libz).
Rob

authors: Rikk landley

repo: landley/toybox


text:
🛑 Kelsi is down

In f68c3ce, Kelsi (https://kelsilesowski.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Kelsi is back up in 960470a.


text:
🛑 trixmall.com is down

In 892541a, trixmall.com (https://www.trixmall.com/) was down:

HTTP code: 403
Response time: 309 ms

Resolved: trixmall.com is back up in 1a7feae.

repo: lanen/bs-site


text:
🛑 vipgifts.net is down

In 8073b60, vipgifts.net (https://vipgifts.net) was down:

HTTP code: 567
Response time: 812 ms

Resolved: vipgifts.net is back up in b7e4dba after 39 minutes.


text:
🛑 rexingsports.cn is down

In 2da47a8, rexingsports.cn (https://www.rexingsports.cn) was down:

HTTP code: 567
Response time: 955 ms

Resolved: rexingsports.cn is back up in 2b83f21 after 14 minutes.


text:
🛑 rexingsports.cn is down

In 9dc1369, rexingsports.cn (https://www.rexingsports.cn) was down:

HTTP code: 567
Response time: 479 ms

Resolved: rexingsports.cn is back up in 92deb24 after 19 minutes.


text:
Im new, dont Understand how to get Retrieval/retrieval agents running

Hi iwant to get the retrival/retrival agents running but i dont understand the instructions for supbase. It says to paste code into my database. Where would that code go? where is the database?

Create a supabase project
In that go to the SQL editor and paste the vector db instantiation code
https://supabase.com/docs/guides/ai/examples/nextjs-vector-search?queryGroups=database-method&database-method=dashboard

authors: akdeb buildcity

repo: langchain-ai/langchain-nextjs-template


text:
@tool decorator for StructuredTool.from_function doesn't fill in the __name__ attribute correctly

System Info
Macos: 13.4.1 (apple silicon M1)
python version 3.10.13
relevant packages:
langchain 				0.0.334
pydantic					1.10.13
pydantic_core			2.10.1
Who can help?
@hwchase17 @agola11
Information

[X] The official example notebooks/scripts
[ ] My own modified scripts

Related Components

[ ] LLMs/Chat Models
[ ] Embedding Models
[ ] Prompts / Prompt Templates / Prompt Selectors
[ ] Output Parsers
[ ] Document Loaders
[ ] Vector Stores / Retrievers
[ ] Memory
[X] Agents / Agent Executors
[X] Tools / Toolkits
[X] Chains
[ ] Callbacks/Tracing
[ ] Async

Reproduction
https://colab.research.google.com/drive/18d2UIFd3LHwkD3ml6_OydetvytKNnoBW?usp=sharing

from langchain.tools import tool
define a simple structured function
Use StructuredTool.from_function(simple_function)

Expected behavior
I expected that it would either work, or tell me that the @tool decorator is not meant to be used with StructuredTool. This is not specified anywhere in the docs or code.

I see that im actually using the decorator incorrectly. closing issue.

repo: langchain-ai/langchain


text:
Issue: Pinecone retriever with Cosine Similarity is treated like Cosine Distance

Issue you'd like to raise.
When using document search from the existing Pinecone index that was created using Cosine Similarity in the ConversationalRetrievalChain,  the score_theshold would eliminate most relevant documents instead of least relevant ones because the similarity metric will be converted to distance.
In _select_relevance_score_fn it calls the _cosine_relevance_score_fn - which converts the similarity returned from Pinecone search to distance.
Then, filtering the documents based on the score_threshold eliminates the most relevant documents instead of least relevant ones.
Suggestion:
Pinecone subclass should override the _cosine_relevance_score_fn to preserve the similarity, since it is what originally comes back from the Pinecone similarity search.

I think this analysis is mostly correct - when using cosine distance pinecone returns a [-1, 1] score where higher is better according to the docs (in practice though I could never simulate negative values).
Seems that it could be enough to cap negative values at 0 and otherwise return what's returned from pinecone.

authors: olegshirokikh ruiramos


text:
Adds progress bar to VertexAIEmbeddings

Description: Adds progress bar to VertexAIEmbeddings
Issue: related issue https://github.com/langchain-ai/langchain/issues/13637

Signed-off-by: ugm2 unaigaraymaestre@gmail.com

Hi @hwchase17 ! I'm sure you guys are all swamped, but just wondering what's the status on this 🙂 Thanks!!

sorry for delay @ugm2 - this was moved to community package and as such theres some merge conflicts

@hwchase17 hi! I see you guys have changed to use langchain_community. So I adapted the code I had added to what's currently in vertexai.py. You can review now


text:
Fix invalid usage of defaultProvider in Bedrock web.

Should match: https://github.com/langchain-ai/langchainjs/blob/c2169e9facf5953cd3eca92f529107eb5cd392c8/langchain/src/llms/bedrock/web.ts#L99
Otherwise, this error is thrown:
✘ [ERROR] Could not resolve "@aws-sdk/credential-provider-node"

Oh dear must have slipped through CC @dqbd

Thank you!

repo: langchain-ai/langchainjs


text:
Serialization error when executing traceback at the end of workflow execution

Checked other resources

[X] I added a very descriptive title to this issue.
[X] I searched the LangGraph/LangChain documentation with the integrated search.
[X] I used the GitHub search to find a similar question and didn't find it.
[X] I am sure that this is a bug in LangGraph/LangChain rather than my code.
[X] I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code
from pydantic import BaseModel
from snowflake.snowpark import Session

class BaseModelWithExclusions(BaseModel):
    class Config:
        arbitrary_types_allowed = True  # Allow arbitrary types like Session

class GetCategoriesInput(BaseModelWithExclusions):
    sp_session: Session
    data: str

class SQLSnowparkQueryInput(BaseModelWithExclusions):
    sp_session: Session
    query: str

# in another file:
for s in self._workflow.stream(message=user_prompt):
        if "end" not in s:
            print("####")
            print(s)
            # print(s["messages"])
            print("----")

Error Message and Stack Trace (if applicable)
Traceback (most recent call last):
  File "/Users/henrymac/Documents/data_athena_snowflake/src/multi_agents/workflows/chatbot_v0/graph.py", line 263, in <module>
    exec_thread_id = chatbot_manager.run()
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/Documents/data_athena_snowflake/src/multi_agents/workflows/chatbot_v0/graph.py", line 240, in run
    for s in self._workflow.stream(message=user_prompt):
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 1240, in stream
    with SyncPregelLoop(
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/loop.py", line 754, in __exit__
    return self.stack.__exit__(exc_type, exc_value, traceback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/contextlib.py", line 589, in __exit__
    raise exc_details[1]
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/contextlib.py", line 574, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/executor.py", line 105, in __exit__
    task.result()
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/loop.py", line 680, in _checkpointer_put_after_previous
    prev.result()
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/executor.py", line 70, in done
    task.result()
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/henrymac/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/pregel/loop.py", line 682, in _checkpointer_put_after_previous
    cast(BaseCheckpointSaver, self.checkpointer).put(
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/memory/__init__.py", line 330, in put
    self.serde.dumps_typed(c),
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 192, in dumps_typed
    return "msgpack", _msgpack_enc(obj)
                      ^^^^^^^^^^^^^^^^^
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 476, in _msgpack_enc
    return enc.pack(data)
           ^^^^^^^^^^^^^^
  File "msgpack/_packer.pyx", line 279, in msgpack._cmsgpack.Packer.pack
  File "msgpack/_packer.pyx", line 276, in msgpack._cmsgpack.Packer.pack
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 232, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 267, in msgpack._cmsgpack.Packer._pack
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 227, in _msgpack_default
    _msgpack_enc(
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 476, in _msgpack_enc
    return enc.pack(data)
           ^^^^^^^^^^^^^^
  File "msgpack/_packer.pyx", line 279, in msgpack._cmsgpack.Packer.pack
  File "msgpack/_packer.pyx", line 276, in msgpack._cmsgpack.Packer.pack
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 232, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 232, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 265, in msgpack._cmsgpack.Packer._pack
  File "msgpack/_packer.pyx", line 213, in msgpack._cmsgpack.Packer._pack_inner
  File "msgpack/_packer.pyx", line 267, in msgpack._cmsgpack.Packer._pack
  File "/Users/henrymac/Documents/data_athena_snowflake/.venv3.11/lib/python3.11/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 409, in _msgpack_default
    raise TypeError(f"Object of type {obj.__class__.__name__} is not serializable")
TypeError: Object of type Session is not serializable

Description
I have defined two custom base models for my tool calls since I need to pass an active snowflake session to my tools.
It works as expected, the workflow runs from start to end perfectly, but at the end of the workflow.stream execution, the traceback tries to do a serialization.
So, how can I modify this behaviour and use a different serialization to avoid this error?
for s in self._workflow.stream(message=user_prompt):
                if "end" not in s:
                    print("####")
                    print(s)
                    # print(s["messages"])
                    print("----")

System Info
langchain==0.3.1
langchain-anthropic==0.2.1
langchain-core==0.3.6
langchain-openai==0.2.1
langchain-text-splitters==0.3.0
platform mac
python version 3.11

@henryf3 there are two ways to solve this:
(1) you can pass Session in the config instead of the state (e.g. workflow.stream(inputs, config={"configurable": {"session": session}}))
(2) you can implement a custom serializer on top of JsonPlusSerializer that handles the Session objects
let me know if you have more questions!

@vbarda thanks, it worked perfectly

repo: langchain-ai/langgraph


text:
Adds Mermaid graph support

CC @nfcampos

repo: langchain-ai/langgraphjs


text:
[FEATURE] CEREBRAS Language Model Support

CEREBRAS Language Model Support
Implement support for the CEREBRAS API (https://inference-docs.cerebras.ai/introduction).
CEREBRAS does have some support for the Open AI interface but it does not seem 100% compatible. Specifically streaming does not generate completion events when using the langchain4j Open AI api.

@EtienneRichards did you check/debug what is exactly wrong with streaming? It would be great to fix this (if broken) instead of introducing yet another module

No I did not. I have not tried to look into the internals of langchain4j. I fully understand not just wanting to add a new module if not required. I might dig a bit deeper if I get the time.
Below is the last few lines of a request. Does anything stand-out as a clue?
:06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" The"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 The06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" sorting"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 sorting06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" criteria"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 criteria06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" will"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 will06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" not"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 not06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" be"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 be06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" part"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 part06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" of"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 of06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" the"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 the06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" J"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 J06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":"EX"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
EX06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":"L"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
L06:02:08.756 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":" expression"},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
 expression06:02:08.757 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":"."},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
.06:02:08.757 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk","usage":{"prompt_tokens":5486,"completion_tokens":223,"total_tokens":5709},"time_info":{"queue_time":0.00002547,"prompt_time":0.2121255943423423,"completion_time":0.13563454465765767,"total_time":0.36299586296081543,"created":1731322928}}
06:02:08.758 [OkHttp https://api.cerebras.ai/...] DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onClosed()

@EtienneRichards this seems correct. Here is how the request/response from OpenAI looks like:
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.RequestLoggingInterceptor.logDebug()
DEBUG: Request:
- method: POST
- url: http://langchain4j.dev:8082/v1/chat/completions
- headers: [Accept: text/event-stream], [Authorization: Bearer sk-FS...Y5], [User-Agent: langchain4j-openai]
- body: {
  "model" : "gpt-4o-mini",
  "messages" : [ {
    "role" : "user",
    "content" : "What is the capital of Germany?"
  } ],
  "temperature" : 0.0,
  "stream" : true,
  "stream_options" : {
    "include_usage" : true
  }
}

2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.ResponseLoggingInterceptor.logDebug()
DEBUG: Response:
- status code: 200
- headers: [Server: nginx/1.18.0], [Date: Mon, 11 Nov 2024 11:19:50 GMT], [Content-Type: text/event-stream; charset=utf-8], [Transfer-Encoding: chunked], [Connection: keep-alive], [access-control-expose-headers: X-Request-ID], [openai-organization: liubarskyi], [openai-processing-ms: 189], [openai-version: 2020-10-01], [x-ratelimit-limit-requests: 5000], [x-ratelimit-limit-tokens: 4000000], [x-ratelimit-remaining-requests: 4999], [x-ratelimit-remaining-tokens: 3999975], [x-ratelimit-reset-requests: 12ms], [x-ratelimit-reset-tokens: 0s], [x-request-id: req_b8b00211e6175270be21e54d65b43115], [strict-transport-security: max-age=31536000; includeSubDomains; preload], [CF-Cache-Status: DYNAMIC], [X-Content-Type-Options: nosniff], [CF-RAY: 8e0de0afb81bdd1a-ATL], [alt-svc: h3=":443"; ma=86400], [X-Cache-Status: HIT]
- body: [skipping response body due to streaming]
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"The"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" capital"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" of"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Germany"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" is"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Berlin"},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":7,"total_tokens":21,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() [DONE]
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onClosed()
DEBUG: onClosed()

Seems like the CEREBRAS trace is missing the second to last event:
Open AI
DEBUG: onEvent() {"id":"chatcmpl-ASMiPgu4FF3PK7OaAfY8IYG1Z8I9d","object":"chat.completion.chunk","created":1731323865,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":7,"total_tokens":21,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}}
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onEvent()
DEBUG: onEvent() [DONE]
2024-11-11 12:19:50 [OkHttp http://langchain4j.dev:8082/...] dev.ai4j.openai4j.StreamingRequestExecutor.onClosed()
DEBUG: onClosed()

CEREBRAS
DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{"content":"."},"index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk"}
06:02:08.757 [OkHttp https://api.cerebras.ai/...]
DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onEvent() {"id":"chatcmpl-e5e42a43-c6cf-4ef1-b5ec-fb38ee4e8dbe","choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1731322928,"model":"llama3.1-70b","system_fingerprint":"fp_55ebaf7e1e","object":"chat.completion.chunk","usage":{"prompt_tokens":5486,"completion_tokens":223,"total_tokens":5709},"time_info":{"queue_time":0.00002547,"prompt_time":0.2121255943423423,"completion_time":0.13563454465765767,"total_time":0.36299586296081543,"created":1731322928}}
06:02:08.758 [OkHttp https://api.cerebras.ai/...]
DEBUG dev.ai4j.openai4j.StreamingRequestExecutor -- onClosed()

@EtienneRichards do you mean DONE? So in this case the stream just hangs indefinitely?

Yes, DONE.

Other providers that have an Open AI compatible interface do not have this issue. So it feels like this is an issue with CEREBRAS then. The right thing to do I think is to first see if CEREBRAS can update their server and make it more compatible with Open AI.
For now I think I need to close this issue, see if I can work with CEREBRAS and if that fails I will take the path you suggested.

The fix I propose will be useful not only for cerebras. IIRC there was similar issues with other inference APIs. The fix is simple and does not seem to harm, so I would implement it in any case.

But ofc it would be great if cerebras fixed this on their side as well

Thank you.

@EtienneRichards would you like to help us with fixing this issue in openai4j please? 🙏

I am just a sheep farmer that happens to write some software for our breed association. I think I should sit this one out.

@langchain4j  I noticed that this issue doesn't have an assignee yet. I've implemented a solution and would be happy to create a PR to address it. Let me know if you'd like me to proceed!

@emredmrcan could you please clarify what exactly did you implement? Feel free to open a PR

@langchain4j  I implemented a solution using an AtomicBoolean to track streaming completion:

Added AtomicBoolean streamingCompletionCalled to track whether the [DONE] event has been received
Set streamingCompletionCalled to TRUE only when the [DONE] event arrives
In the onClosed event handler, check if the stream has potentially hung indefinitely
If the stream appears to be hanging (streamingCompletionCalled is FALSE), manually trigger the streamingCompletionCallback

This approach ensures that the completion callback is called even if the [DONE] event is not received.
I will create a PR soon. Please let me know if this approach is missing anything or can be further improved 🙏

@emredmrcan got it, thanks for the explanation! How does it compare to always calling completion callback only in onClosed()? Then we could ignore [DONE] alltogether?

@emredmrcan got it, thanks for the explanation! How does it compare to always calling completion callback only in enclosed ()? Then we could ignore [DONE] altogether?

It makes sense, but I have two questions:

Iyo, what was the main reason for checking the [DONE] event from the beginning? Was it a simple mistake, or was there a specific need for it?
Iyo, will there be any event in the future that does not require triggering the completion callback?

Iyo, what was the main reason for checking the [DONE] event from the beginning? Was it a simple mistake, or was there a specific need for it?

IIRC, this is how OpenAI proposed to check for the end of stream in their examples/docu. I did not think of it much at that point of time. I guess onClose() was a viable option as well.

Iyo, will there be any event in the future that does not require triggering the completion callback?

What do you mean? IIUC, onClose() should be called in any case, this is not a "feature" of OpenAI, this is am SSE/HTTP "feature"

What do you mean? IIUC, onClose() should be called in any case, this is not a "feature" of OpenAI, this is am SSE/HTTP "feature"

@langchain4j Thank you for clarifying! I wasn’t fully aware of the functionality and was trying to find a correlation between the [DONE] event and onClose. I’ll move the callback to onClose and remove the [DONE] check, which should resolve the issue.

authors: EtienneRichards emredmrcan langchain4j


text:
Issue with Cohere Component used as Language Model in Agent Component

Bug Description
when i try to use the cohere component with the Agent as a custom language model it shows me this error and when am using the google(gemini) component it works just fine
Reproduction
the error message:
An error occured in the Agent Component, stopping your flow. See below for more details.
Error details:
BadRequestError
invalid request: tool names can only contain certain characters (A-Za-z0-9_) and can't begin with a digit (provided name: 'CurrentDate-get_current_date').
Expected behavior
using cohere models as a llms for the Agent
Who can help?
No response
Operating System
MacOS Sequoia 15.2 (24C101) Safari
Langflow Version
langflow web ui
Python Version
None
Screenshot

Flow File
almatjar Chat.json

@dosu where do i rename the tool because i opened the cohere component code and found nothing with this 'CurrentDate-get_current_date' name, but i think it related to the Agent component idk tbh

@dosu iam using the web ui

repo: langflow-ai/langflow


text:
Add zeroing out of material internal energy if its mass fraction is s…

…ufficiently low so as not to be participating in the solve. This fixes issues in the event the passed in internal energies are uninitialized.

PR Summary
This PR fixes issues seen with uninitialized data. If internal energies that are passed are uninitialized coming into the get_sg_eos_function, they may be remain so and cause downstream checks to fail.
This is not the full changeset I had for debugging. As of now, the get_sg_eos function will always return 0. In the past, the value passed back was the number of failed PTE solves, though this should not necessarily result in a crash. That said, I had also added checks for nans in outputs, and if that occurs we may want to cause a hard stop on execution.
Should that be part of a different PR @jhp-lanl ? Thoughts? This should be enough to get you going again though if you want to continue with debugging / vetting efforts.

PR Checklist

[x] Adds a test for any bugs fixed. Adds tests for new features.
[x] Format your changes by using the make format command after configuring with cmake.
[x] Document any new features, update documentation for changes made.
[x] Make sure the copyright notice on any files you modified is up to date.
[x] After creating a pull request, note it in the CHANGELOG.md file.
[x] LANL employees: make sure tests pass both on the github CI and on the Darwin CI

If preparing for a new release, in addition please check the following:

[x] Update the version in cmake.
[x] Move the changes in the CHANGELOG.md file under a new header for the new release, and reset the categories.

Alright I'll pull the trigger on this when the checks pass @jhp-lanl.

repo: lanl/singularity-eos


text:
小米6.0的手机

我用的小米note，系统是6.0.1的，调用 StatusBarUtil.setTranslucent(this);没什么反应

@xie3120 先测试下 demo 如果正常的话看下你的使用姿势

我现在项目里面要实现的是，先是沉浸式状态栏，滑动的时候标题栏变白色，状态栏也变白色，状态栏的字变成黑色。这个能实现么。

1.5 版本已经添加设置状态栏模式方法，请更新到最新版本
  StatusBarUtil.setLightMode(Activity activity)
  StatusBarUtil.setDarkMode(Activity activity)

repo: laobie/StatusBarUtil


text:
跟布局是CoordinatorLayout toolbar会被通知栏遮盖

使用了你的方法也不行

@qinyang1018
说明下具体问题，你这样说的我不明白，有截图的话最好

这样可以吗？

额  为什么我传上来的布局文件花图

你用的哪个方法呢？请具体说明问题，否则我不想浪费时间

@qinyang1018 重新截图发上来，不然没法看，具体说明你的问题，不行你先在我的 demo 上修改，看看效果

布局的根视图是CoordinatorLayout   ，用的  StatusBarUtil.setTranslucentForCoordinatorLayout(this, 50);这个方法

`

<android.support.design.widget.CoordinatorLayout          xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapse_toolbar"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <RelativeLayout
            android:id="@+id/image_bg"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/test_item"
            app:layout_collapseMode="parallax">

            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:alpha="0.5"
                android:background="#cc000000" />

            <ImageView
                android:id="@+id/team_icon"
                android:layout_width="70dp"
                android:layout_height="70dp"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginTop="5dp"
                android:src="@drawable/test_header" />

            <TextView
                android:id="@+id/team_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/team_icon"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginTop="2dp"
                android:textColor="@color/white"
                android:text="@string/test_name"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/team_leader"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/team_name"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginTop="2dp"
                android:text="@string/test_team_leader"
                android:textColor="#dddddd"
                android:textSize="12sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/team_leader"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginTop="2dp"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:paddingBottom="2dp"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:paddingTop="2dp"
                    android:text="@string/test_team_type"
                    android:background="@drawable/team_detail_bg"
                    android:textColor="#dddddd"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:gravity="center"
                    android:paddingBottom="2dp"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:paddingTop="2dp"
                    android:text="@string/test_team_age"
                    android:background="@drawable/team_detail_bg"
                    android:textColor="#dddddd"
                    android:textSize="12sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:paddingBottom="2dp"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:paddingTop="2dp"
                    android:text="@string/test_team_style"
                    android:background="@drawable/team_detail_bg"
                    android:textColor="#dddddd"
                    android:textSize="12sp" />

            </LinearLayout>
        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:gravity="top"
            android:minHeight="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:titleMarginTop="15dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@android:color/transparent"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:src="@drawable/nav_btn_back_white" />

                <TextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="@string/test_name" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="10dp"
                    android:text="@string/modify_info"
                    android:textColor="@color/white"
                    android:textSize="16sp" />

            </RelativeLayout>
        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_gravity="bottom"
        app:tabTextColor="@color/three"
        app:tabSelectedTextColor="@color/common_red"
        app:tabIndicatorColor="@color/common_red" />
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/common_line"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

</android.support.design.widget.CoordinatorLayout>
`

上面是布局文件

这是效果图

这是代码中使用的
还需要其他截图吗？   刚才实在不好意思

@qinyang1018  CollapsingToolbarLayout 有一个滑动变化状态栏的过程，本工具类无法处理
看这篇文章中后面提到的方法，处理这种布局
更简单更全的material design状态栏 - u013260551的专栏 - 博客频道 - CSDN.NET

现在是不伸缩和折叠的状态都会被通知栏遮盖     我先看下您发的这个资料  thank you

你这个其实很简单，给 titleBar 设置一个 paddingTop 就行了，状态栏的高度可以获取到

恩   刚才去掉了theme里面的 true这个可以不被遮盖了  现在就剩全部伸展开时不是透明的   我看下你刚才发的那个资料 谢谢了

嗯 你这个需求看一下那篇文章，可以兼容到 4.4 的

好的  谢谢了


text:
Redis::connection causes segmentation fault

Larastan Version: 2.9.2
--level used: 6
Pull request with failing test: N/A private code

Description
Interacting with Redis::connection causes segmentation fault
This seems to be related to https://github.com/phpstan/phpstan/issues/6300 which was fixed in
https://github.com/phpstan/phpstan-src/commit/9ab4e6fd8ef29d7bf7b0b729250e04f3dd5ad75d
Running tests with just phpstan pass fine, but with the larastan extension included it causes a segmentation fault anywhere that Redis::connection is used.
I'm using phpstan 1.10.62
Laravel code where the issue was found
        $redis = Redis::connection('session');
        $redis->del($basket->redisName . ':' . Session()->get('accountUser')->id);

can you run with xdebug enabled and the --debug flag as mentioned in the issue you linked and provide the stack trace? it's likely another infinite recursion bug in a larastan extension and that would make it easier to track down

Yes of course.
Running with xdebug it does indeed say infinite recursion has been detected.
The stack trace is huge, so attaching as a file
stacktrace.txt
I've taken out the base path as it relates to a project under NDA, hope this helps though

So you don't have to manually parse through the stack trace, here's what the gpt has to say:

The recurring pattern involves these components:

PHPStan\Type\ObjectType->hasMethod() calls leading to
PHPStan\Reflection\Mixin\MixinMethodsClassReflectionExtension->findMethod() and back to
PHPStan\Type\ObjectType->hasMethod()
This cycle suggests that there's an issue within the handling of method existence checks and finding methods in mixed types or extensions, likely causing the infinite loop.

More specifically, the loop seems to start around entries #474 to #489, where you have:

PHPStan\Reflection\ClassReflection->hasMethod() calling
PHPStan\Type\ObjectType->hasMethod(), which then calls
PHPStan\Reflection\Mixin\MixinMethodsClassReflectionExtension->findMethod(), and the process repeats.
The recursion might be due to the way MixinMethodsClassReflectionExtension interacts with ObjectType when trying to resolve whether a class has a specific method. This could be triggered by a complex type hierarchy or misuse of mixins that PHPStan tries to analyze, leading to a loop.

Not only Redis::connection, but Redis::sIsMember or Redis::sMembers or any other static method cause this error.
I had to move all Redis methods to a trait file so I could exclude just that file from stan.
@Phil-Barker this should of course be fixed upstream, but in the meanwhile you can fix your stan like this;
includes:
    - ./vendor/larastan/larastan/extension.neon

parameters:

    paths:
        - ...
    excludePaths:
        - app/Models/Traits/RedisTrait.php

RedisTrait.php
use Illuminate\Support\Facades\Redis;

trait RedisTrait
{
    private function redisIsMember(string $key, string|int $value): bool
    {
        return Redis::sIsMember($key, (string) $value);
    }

    private function redisMembers(string $key): array
    {
        return Redis::sMembers($key);
    }
}

@Phil-Barker,
PHPStan v1.11.1 includes a couple of fixes for recursion, could you check if this is still an issue?

@calebdw

PHPStan v1.11.1 includes a couple of fixes for recursion, could you check if this is still an issue?

I tried with the latest php 8.3, and phpstan 1.11.1 and it still times out...
Note: Using configuration file phpstan.neon.
 1073/1113 [==========================>-]  96%The following exception is caused by a process timeout
Check https://getcomposer.org/doc/06-config.md#process-timeout for details

Same issue here, here is the stack trace
error.txt

authors: Phil-Barker calebdw dantes4ur mad-briller promatik

repo: larastan/larastan


text:
Activating Open Collective

Hi, I'm making updates for Open Collective. Either you or a supporter signed this repo up for Open Collective. This pull request adds backers and sponsors from your Open Collective https://opencollective.com/Enso ❤
It adds two badges at the top to show the latest number of backers and sponsors. It also adds placeholders so that the avatar/logo of new backers/sponsors can automatically be shown without having to update your README.md. [more info]. See how it looks on this repo.
We have also added a postinstall script to let people know after npm|yarn install that you are welcoming donations (optional). [More info]
You can also add a "Donate" button to your website and automatically show your backers and sponsors there with our widgets. Have a look here: https://opencollective.com/widgets
P.S: As with any pull request, feel free to comment or suggest changes. The only thing "required" are the placeholders on the README because we believe it's important to acknowledge the people in your community that are contributing (financially or with code!).
Thank you for your great contribution to the open source community. You are awesome! 🙌
And welcome to the open collective community! 😊
Come chat with us in the #opensource channel on https://slack.opencollective.com - great place to ask questions and share best practices with other open source sustainers!

Apparently all the repo's links related to OpenCollective are broken. I don't know where to start debugging it. Maybe you can point me in a direction. Thank you!

I just checked, and they seem to work - I am not sure what happened. If you have other issues, create an issue on the Open Collective Front End. :)

authors: aocneanu monkeywithacupcake

repo: laravel-enso/Enso


text:
Fix date column always shown in english

Changes the use of Carbon's format for translatedFormat so Text columns containing dates are shown in the correct language when changing locales.

Thanks!

authors: Vextil danharrin

repo: laravel-filament/filament


text:
Use correct file reference

Point to the correct config file in the readme.

Thanks @robindrost !

authors: robindrost sandervanhooft

repo: laravel/cashier-mollie


text:
Pagination does not works with binding named param in whereRaw

When I make usual where with param, the pagination works fine
$employees = $employees->where('firstName', 'LIKE',
    '%'.DbHelper::escapeLike($filters['filter-name']).'%');

but when I replace where on whereRaw with named binding, the pagination does not works
$employees = $employees->whereRaw('concat_ws(" ", lastName, firstName, middleName) LIKE :filterName',
    ['filterName' => '%'.DbHelper::escapeLike($filters['filter-name']).'%']);

Error in log:
Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters (SQL: select count(*) as aggregate from `employees` where `employees`.`deleted_at` is null and `lastName` LIKE Ю% and concat_ws(" ", lastName, firstName, middleName) LIKE :filterName)' in C:\htdocs\laravel\webserver\www\vendor\laravel\framework\src\Illuminate\Database\Connection.php:651

Pagination works with whereRaw position binding
$employees = $employees->whereRaw('concat_ws(" ", lastName, firstName, middleName) LIKE ?',
    ['%'.DbHelper::escapeLike($filters['filter-name']).'%']);

Did you try to use parameters without names?
$employees = $employees->whereRaw('concat_ws(" ", lastName, firstName, middleName) LIKE ?',
    ['%'.DbHelper::escapeLike($filters['filter-name']).'%']);

Yes, Ii works with unnamed parameters. But with named doesn't!

Invalid parameter number: mixed named and positional parameters

That's because PDO does not support mixing of named and unnamed parameters. While Laravel always appends only unnamed ones.

@GrahamCampbell  Why you close this issue? In Laravel documentation wrote example with named parameters!
I am new in laravel, about one week. And I think examples from documentation should works. With pagination also.
May be change documentation examples, and close issue after that?

@GrahamCampbell  find whereRaw here http://laravel.com/docs/5.1/queries#advanced-where-clauses

Hmmm, well if our docs are wrong, then I'll reopen this.

And I think examples from documentation should works.

Can't find what's wrong with the docs? There is only one example with whereRaw in whereExists and there are no named parameters.
Actually, there are no examples with named parameters at all in docs. What we can do - is to mention that named parameters should not be used at all.

Hmmm, well if our docs are wrong, then I'll reopen this.

Maybe, it is better to open an issue in docs

Maybe, it is better to open an issue in docs

We've disabled issues on that repo.

Also discussed here: http://stackoverflow.com/questions/33721048/laravel-pagination-fails-in-building-the-correct-query

I have the same problem with named parameters. I get an error even when I don't mix named and position parameters.
I had a look at the query builder. It flattens the bindings before using them. The helper that is used to flatten the array ignores the keys and this loses the named parameters. As it stands I don't see any decent way of using named parameters in the query builder.

I don't mix named and position parameters
This cannot be properly detected during runtime.
You should understand, that query builder is not supposed to work with named parameters as it always expects equal count of placeholders and bindings within its default behavior. If you use raw queries and want to use named parameters, execute statements directly or try to use $query->toSql() method and append named bindings manually.

I agree that one cannot use named and positional parameters in the same query. It does not make sense. But I expected to be able to use named parameters only.
I understand that as it stands now I cannot use named parameters. The point I was making is that we should be able to do so. I have a filter query that is processed by many parts of my application (to add joins, conditions, ....). It is safer to have named parameters to avoid position mismatch. Anyway, the query builder should allow to use named parameters, unless it is extremely complex to implement.
What prevent the query builder from being able to process named parameters is two things it does that remove the keys (in getBindings and addBindings).
I extended the query builder and redefined these two methods. Now I can use named parameters.

@seydu I'm just giving my own opinion. As I tried to use named parameters, it was not hard to implement using them, however I came into unexpected consequences when query was being modified in different parts of application (controllers, repoitories, etc).
You are free to make a PR anyway - it might be accepted.

Using named parameters should make it easier to have many components of your application collaborate to build a query.
If you want to avoid conflicts add a unique identifier to your names.
Your components will not be passed the Eloquent query itself, but a wrapper that encapsulates the logic that let them manipulate the underlying Eloquent query.
I want to use the changes I made before I make a PR.
I have already found two places where an instance of the query builder is created. There could be more, I have to check it first.

authors: AlexRadch GrahamCampbell rkgrep salarmehr seydu

repo: laravel/framework